program busses;
var
fin,fout:text;
i,j,n:longint;
a:array[1..10]of longint;
f:array[0..10000000]of longint;
function min(x,y:longint):longint;
begin
if x<y then min:=x else min:=y;
end;
begin
assign(fin,'busses.in'); reset(fin);
assign(fout,'busses.out'); rewrite(fout);
for i:=1 to 10 do read(fin,a[i]);
read(fin,n);
f[0]:=0;
for i:=1 to n do f[i]:=a[1]*i;
for i:=2 to 10 do begin
for j:=i to n do begin
f[j]:=min(f[j],f[j-i]+a[i]);
end;
end;
writeln(fout,f[n]);
close(fin);
close(fout);
end.