while 1:
try:
_=list(map(int,input().split()))
s,t,n=_[0],_[1],_[2]
seat=sum=0
__=3
while n:
n-=1
seat+=_[__]
__+=1
for i in range(3):
if t*0.2<seat:
if i==0:
sum+=t*0.2*s*0.7
elif i==1:
sum+=t*0.2*s*0.8
elif i==2:
sum+=t*0.2*s*0.9
seat-=t*0.2
else:
if i==0:
sum+=seat*s*0.7
elif i==1:
sum+=seat*s*0.8
elif i==2:
sum+=seat*s*0.9
seat=0
if seat>0:
sum+=seat*s
print(int(sum-(s*t*0.3)))
except:
break