program busses;
type
shuzu=array[1..10] of longint;
shuzu1=array[0..500] of longint;
var
s:shuzu;
f:shuzu1;
i,j,k,m,n,temp:longint;
begin
assign(input,'busses.in');reset(input);
assign(output,'busses.out');rewrite(output);
for i:=1 to 10 do
read(s[i]);
readln(n);
for i:=1 to 500 do
f[i]:=maxlongint;
f[0]:=0;
for i:=1 to n do
begin
if i-10<0 then temp:=0
else temp:=i-10;
for j:=i-1 downto temp do
begin
if f[j]+s[i-j]<f[i] then
f[i]:=f[j]+s[i-j];
end; end;
writeln(f[n]);
close(output);
end.