program wydnnj(input,output);
var
n,i,j:longint;
a:array[1..10] of longint;
f:array[0..100] of longint;
begin
assign(input,'busses.in');reset(input);
assign(output,'busses.out');rewrite(output);
for i:=1 to 10 do
read(a[i]);
read(n);
for i:=1 to n do
begin
f[i]:=maxint;
for j:=1 to 10 do
if (i>=j)and(f[i-j]+a[j]<f[i]) then
f[i]:=f[i-j]+a[j];
end;
writeln(f[n]);
close(input);
close(output);
end.