program busses;
const
inp:string='busses.in';
otp:string='busses.out';
var
p:array[1..10]of integer;
dym:array[0..1000]of integer;
n,i,j,min:integer;
f:text;
begin
assign(f,inp);
reset(f);
for i:=1 to 10 do
read(f,p[i]);
readln(f,n);
close(f);
for i:=1 to n do
begin
min:=dym[i-1]+p[1];
for j:=2 to 10 do
if (i-j>=0)and(dym[i-j]+p[j]<min) then
min:=dym[i-j]+p[j];
dym[i]:=min;
end;
assign(f,otp);
rewrite(f);
writeln(f,dym[n]);
close(f);
end.