//2016.11.17比赛
#include<stdio.h>
#include<memory.h>
int main()
{
int s[11]={0},n,f[1000]={0},i,j;
freopen("busses.in","r",stdin);
freopen("busses.out","w",stdout);
for (i=1;i<=10;i++) scanf("%d",&s[i]);
scanf("%d",&n);
for (i=1;i<=1000;i++) f[i]=9999999;
f[0]=0;
for (i=1;i<=n;i++)
{
for (j=1;j<=10;j++)
{
if (f[i-j]+s[j]<f[i]) f[i]=f[i-j]+s[j];
}
}
printf("%d",f[n]);
fclose(stdin);
fclose(stdout);
return 0;
}