program busses;
const inp:string='busses.in';
out:string='busses.out';
var p:array[1..10]of integer;
n,i,mon,min:integer;
f:text;
procedure go(km,mon:integer);
var i:integer;
begin
for i:=1 to 10 do
begin
if i+km<n then
go(km+i,mon+p[i]) else
begin
if mon+p[i]<min then
min:=mon+p[i];
break;
end;
end;
end;
begin
assign(f,inp);
reset(f);
for i:=1 to 10 do
read(f,p[i]);
readln(f,n);
close(f);
min:=maxint;
go(0,0);
assign(f,out);
rewrite(f);
writeln(f,min);
close(f);
end.