program MayLava;
var
scv:array[0..10000000]of longint;
cost:array[0..10]of longint;
n:longint;
procedure start;
var
f:text;
i:longint;
begin
assign(f,'busses.in');
reset(f);
for i:=1 to 10 do
read(f,cost[i]);
readln(f);
readln(f,n);
close(f);
for i:=1 to n do
scv[i]:=maxlongint;
end;
procedure main;
var
i,j:longint;
begin
for i:=1 to 10 do
for j:=0 to n do
if (i<=j) and (scv[j]>scv[j-i]+cost[i]) then
scv[j]:=scv[j-i]+cost[i];
end;
procedure print;
var
f:text;
begin
assign(f,'busses.out');
rewrite(f);
writeln(f,scv[n]);
close(f);
end;
BEGIN
start;
main;
print;
END.