# -*- coding: cp936 -*-
filename=r'物品价格表.txt'
with open(filename,'r') as f:
lines = f.readlines()
dic={}
for line in lines:
if line=='\n': break
temp = line.strip('\n').split('\t')
s=temp[0]+','+temp[1]+','+temp[2]
dic[s]=int(temp[3])
while True:
print '----------------'
s=raw_input('输入合成需要道具:')
if not s: break
li=eval(s)
cost=0
for l in li:
if l[0]==0:break
num=l[3]
index=str(l[0])+','+str(l[1])+','+str(l[2])
cost += dic[index]*num
print '合成成本为:%d' % (cost+3000)