program busses;
var
a:array[1..10]of longint;
m,min,min2:longint;
procedure ini;
var
i:integer;
Begin
assign(input,'busses.in');
assign(output,'busses.out');
reset(input); rewrite(output);
for i:=1 to 10 do read(a[i]);
readln(m);
End;
procedure ouo;
Begin
writeln(min);
close(input); close(output);
End;
procedure goo(xx,zz:integer);
var
ii,jj:integer;
Begin
if xx<m then for ii:=1 to 10 do begin
if xx+ii<=m then goo(xx+ii,zz+a[ii]);
end;
if xx=m then if min2>zz then min2:=zz;
End;
procedure go;
var
i,j,p,l:integer;
k:real;
Begin
k:=1/a[1]; p:=1;
for i:=2 to 10 do
if (i/a[i])>k then begin
k:=i/a[i]; p:=i;
end;
l:=((m-10) div p);
min:=l*a[p];
m:=m-l*p;
min2:=99999;
goo(0,0);
min:=min+min2
End;
Begin
ini;
go;
ouo;
End.