program cch(input,output);
const
maxf=10000;
var
i,j,n:longint;
a:array[1..10] of integer;
f:array[0..maxf] of longint;
begin
assign(input,'busses.in');
assign(output,'busses.out');
reset(input);
rewrite(output);
for i:=1 to 10 do read(a[i]);
read(n);
for i:=1 to maxf do f[i]:=maxlongint;
f[0]:=0;
for i:=1 to 10 do
for j:=i to n do
if f[j]>f[j-i]+a[i] then f[j]:=f[j-i]+a[i];
write(f[n]);
close(input);
close(output);
end.