program busses;
const
maxn=1000;
maxt=1000000;
var
n:longint;
data:array[1..10]of longint;
f:array[0..maxn] of longint;
procedure init;
var
i:longint;
begin
assign(input,'busses.in');
reset(input);
assign(output,'busses.out');
rewrite(output);
data[0]:=0;
for i:=1 to 10 do read(data[i]);
readln;
readln(n);
close(input);
fillchar(f,sizeof(f),0);
end;
procedure main;
var
i,j,t,k:longint;
begin
f[0]:=0;
f[1]:=data[1];
for i:=2 to n do
begin
t:=maxt;
if n>10 then k:=10
else k:=i;
for j:=1 to k do
if f[i-j]+data[j]<=t then t:=f[i-j]+data[j];
f[i]:=t;
end;
end;
begin
init;
main;
writeln(f[n]);
close(output);
end.