program busses;
var
total,money,mini,i,t:integer;
min:real;
a:array[1..10] of byte;
b:array[1..10] of real;
Begin
assign(input,'busses.in');
assign(output,'busses.out');
reset(output);
rewrite(input);
for i:=1 to 10 do read(a[i]);
read(total);
for i:=1 to 10 do
b[i]:=a[i]/i;
money:=0;
while total>0 do begin
if total>10 then t:=10
else t:= total;
min:=201;
for i:=1 to t do
if min>b[i] then begin
min:=b[i];
mini:=i;
end;
dec(total, mini);
money:=money+a[mini];
end;
writeLn(money);
close(input);
close(output);
end.