program busses;
var
f1,f2:text;
a:array[1..10]of integer;
b:array[0..100000]of longint;
i,j,k,n,v:integer;
function min(x,y:integer):integer;
begin
if x<y then min:=x
else min:=y;
end;
begin
assign(f1,'busses.in');
assign(f2,'busses.out');
reset(f1);
rewrite(f2);
for i:= 1to 10 do read(f1,a[i]);
b[0]:=0;
readln(f1,n);
for i:= 1 to n do b[i]:=maxint;
for i:= 1 to n do
for j:= 1 to 10 do begin
k:=1;
while k*j<=i do begin
b[i]:=min(b[i],b[i-k*j]+k*a[j]);
inc(k)
end;
end;
writeln(f2,b[n]);
close(f1);
close(f2);
end.