program busses;
const
name='busses';
var
map:array[0..11]of longint;
f:array[0..101]of longint;
i,j,aim:longint;
function min(l,r:longint):longint;
begin
if l>r
then
exit(r)
else
exit(l);
end;
begin
assign(input,name+'.in');
reset(input);
assign(output,name+'.out');
rewrite(output);
for i:=1 to 10 do
read(map[i]);
readln(aim);
for i:=1 to aim do
f[i]:=maxlongint div 2;
f[0]:=0;
for i:=1 to aim do
for j:=1 to 10 do
if i-j>=0
then
f[i]:=min(f[i-j]+map[j],f[i]);
writeln(f[aim]);
close(output);
end.