program waterfire;
const
fin='busses.in';
fout='busses.out';
var
i,j,n,data:longint;
w,c:array[0..10]of longint;
f:array[0..100] of longint;
f1,f2:text;
Function min(a,b:longint):longint;
Begin
if a<b then min:=a else min:=b;
End;
BEGIN
assign(f1,fin);reset(f1);
assign(f2,fout);rewrite(f2);
for i:=1 to 100 do
f[i]:=maxint;
for i:=1 to 10 do
read(f1,f[i]);
readln(f1);
read(f1,data);
for i:=1 to data do
for j:=1 to i-1 do
f[i]:=min(f[i],f[j]+f[i-j]);
writeln(f2,f[data]);
close(f1);close(f2);
END.