#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int i,m,n,j,a[15],b[15000];
int main()
{
freopen("busa.in","r",stdin);
freopen("busa.out","w",stdout);
for (i=1;i<=10;++i)
{cin>>a[i];}
cin>>n;
for (i=1;i<=n;++i)
b[i]=100000000;
for (i=1;i<=10;++i)
b[i]=a[i];
for (i=2;i<=n;++i)
for (j=1;j<=i-1;++j)
if (b[j]+b[i-j]<b[i]) b[i]=b[j]+b[i-j];
cout<<b[n];
fclose(stdin);
fclose(stdout);
return 0;
}