program busses;
var
i,min,s,j:longint;
a:array[1..10]of integer;
f:array[1..10000]of longint;
begin
assign (input,'busses.in');
reset (input);
assign (output,'busses.out');
rewrite (output);
for i:=1 to 10 do
read (a[i]);
readln;
read (s);
f[1]:=a[1];
for i:=2 to s do
begin
min:=100000000;
if i>10 then
for j:=i-9 to i-1 do
begin
if f[j]+f[i-j]<min then
min:=f[j]+f[i-j]
end
else
for j:=1 to i-1 do
begin
if f[j]+f[i-j]<min then
min:=f[j]+f[i-j];
if a[i]<min then
min:=a[i]
end;
f[i]:=min
end;
write (f[s]);
close (input);
close (output)
end.