#44970: 真有那麼難???


x__1 (^_^ 809-34)

學校 : 臺北市立麗山國中
編號 : 294220
來源 : [111.248.235.102]
最後登入時間 :
2025-08-04 11:16:52

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