program xmz;
var
i,b,n,a:longint;
f1,f2:text;
z:array[1..10]of integer;
f:array[0..1000]of longint;
begin
assign(f1,'busses.in');assign(f2,'busses.out');
reset(f1);rewrite(f2);
for i:=1 to 10 do
read(f1,z[i]);
for i:=1 to 1000 do f[i]:=200000;
read(f1,n);
for a:=1 to n do
if a>10 then
begin
for b:=a-10 to a-1 do
if f[b]+z[a-b]<f[a] then
f[a]:=f[b]+z[a-b];
end
else
for b:=0 to a-1 do
if f[b]+z[a-b]<f[a] then
f[a]:=f[b]+z[a-b];
writeln(f2,f[n]);
close(f1);close(f2);
end.