program busses;
var
i,j:integer;
p:array[1..10] of integer;
f:array[0..1000] of integer;
s:integer;
procedure init;
begin
for i:=1 to 10 do read(p[i]);
read(s);
end;
begin
assign(input,'busses.in');
reset(input);
assign(output,'busses.out');
rewrite(output);
init;
f[0]:=0;
for i:=1 to s do f[i]:=i*p[1];
for i:=2 to s do
for j:=1 to 10 do
if i-j>=0 then if f[i-j]+p[j]<f[i] then f[i]:=f[i-j]+p[j];
writeln(f[s]);
close(input);
close(output);
end.