Program busses;
Type
sc=array [1..10] of longint;
sc1=array [0..10000] of longint;
Var
s:sc;
a:sc1;
i,j,l:longint;
Begin
assign(input,'busses.in');
assign(output,'busses.out');
reset(input);
rewrite(output);
for i:=1 to 10 do read(s[i]);
readln;
readln(l);
for i:=1 to l do a[i]:=999999999;
a[0]:=0;
for i:=0 to l do begin
for j:=1 to 10 do
if i+j<=l then
if a[i]+s[j]<a[i+j] then
a[i+j]:=a[i]+s[j];
end;
writeln(a[l]);
close(input);
close(output);
End.