#include<cstdio>
#include<cstring>
using namespace std;
int a[11],l,f[101],i,j;
int min(int x,int y){return x<y?x:y;}
int Main()
{
freopen("busses.in","r",stdin);freopen("busses.out","w",stdout);
memset(f,0x3f,sizeof(f));f[0]=0;
for(i=1;i<=10;i++)scanf("%d",&a[i]);
scanf("%d",&l);
for(i=1;i<=l;i++)for(j=i-1;j>=i-10&&j>=0;j--)
f[i]=min(f[i],f[j]+a[i-j]);
printf("%d\n",f[l]);
return 0;
}
int main(){;}
int syy=Main();