program elysian;
const
fin='busses.in';fout='busses.out';
var
a:array[0..10] of longint;
f:array[0..100000] of longint;
f1,f2:text;
n:longint;
procedure main;
var
i,j,k,x:longint;
begin
f[1]:=a[1];
for i:=2 to n do
begin
if i-10>=0 then x:=10 else x:=i;
f[i]:=f[i-1]+a[1];
for k:=2 to x do
if i-k>=0 then
if f[i-k]+a[k]<f[i] then f[i]:=f[i-k]+a[k];
end;
end;
procedure init;
var
i:longint;
begin
assign(f1,fin);reset(f1);
for i:=1 to 10 do read(f1,a[i]);
readln(f1,n);
close(f1);
end;
begin
init;
main;
assign(f2,fout);rewrite(f2);
writeln(f2,f[n]);
close(f2);
end.