program busses(input,output);
var
i,j,k:longint;
a:array [1..10] of longint;
f:array [0..501] of longint;
n:longint;
ans:int64;
begin
assign(input,'busses.in');
assign(output,'busses.out');
reset(input);
rewrite(output);
for i:=1 to 10 do
read(a[i]);
readln(n);
for i:=1 to 500 do f[i]:=2140000000;
f[0]:=0; ans:=0;
for i:= 1 to n
do
for j:= 1 to 10 do begin
if i-j<0 then break;
if (f[i-j]+a[j])<f[i] then f[i]:=f[i-j]+a[j];
end;
ans:=f[n];
writeln(ans);
close(input);
close(output);
end.