program busses(input,output);
var
v:array[1..10]of longint;
f:array[0..600]of longint;
i,j,n:longint;
begin
assign(input,'busses.in');assign(output,'busses.out');
reset(input);rewrite(output);
for i:=1 to 10 do
read(v[i]);
readln;
read(n);
for i:=1 to 600 do f[i]:=maxint;
f[0]:=0;
if n=0 then write(0)
else begin
for i:=1 to 10 do
for j:=0 to n do
if j-i>=0 then
if f[j]>f[j-i]+v[i] then f[j]:=f[j-i]+v[i];
write(f[n]);
end;
close(input);close(output);
end.