program bing;
var
f1,f2:text;
a:array[0..10] of integer;
b:array[0..1000] of longint;
s:integer;
procedure init;
var
i:integer;
begin
assign(f1,'busses.in');reset(f1);
assign(f2,'busses.out');rewrite(F2);
for i:=1 to 10 do
read(f1,a[i]);
a[0]:=0;
readln(f1,s);
end;
procedure nb;
var
i,j,t,k:longint;
begin
for i:=1 to s do
begin
t:=100000;
if i>10 then k:=10 else k:=i;
for j:=1 to k do
if a[j]+b[i-j]<t then t:=a[j]+b[i-j];
b[i]:=t;
end;
end;
begin
init;
nb;
write(f2,b[s]);
close(f1);close(f2);
end.