program bly(input,output);
var
n,i,j:longint;
c:array[1..10] of longint;
f:array[0..100000] of longint;
f1,f2:text;
function min(a,b:longint):longint;
begin
if a<b then min:=a else min:=b;
end;
begin
assign(f1,'busses.in');
reset(f1);
for i:=1 to 10 do read(f1,c[i]);
readln(f1);
readln(f1,n);
close(f1);
for i:=1 to n do f[i]:=maxlongint;
for i:=1 to 10 do
for j:=i to n do
if i<=j then f[j]:=min(f[j-i]+c[i],f[j]);
assign(f2,'busses.out');
rewrite(f2);
write(f2,f[n]);
close(f2);
end.