program ooo;
var
b:array[0..10] of longint;
c:array[0..10000000] of longint;
i,j,k,n,m:longint;
t:text;
begin
assign(t,'busses.in');
reset(t);
for i:=1 to 10 do
read(t,b[i]);
readln(t);
readln(t,m);
close(t);
for i:=1 to m do
c[i]:=maxlongint;
for i:=1 to m do
for j:=1 to 10 do
if i-j>=0 then
if c[i]>c[i-j]+b[j] then
c[i]:=c[i-j]+b[j];
assign(t,'busses.out');
rewrite(t);
write(t,c[m]);
close(t);
end.