program busses(input,output);
var
v:array[1..10]of longint;
f:array[-10..10000]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 10000 do f[i]:=10000;
if n=0 then write(0)
else begin
for i:=1 to 10 do
for j:=0 to n do
if f[j]>f[j-i]+v[i] then f[j]:=f[j-i]+v[i]
else f[j]:=f[j];
write(f[n]);
end;
close(input);close(output);
end.