arr = []

while True:
	try:
		line = input()
		arr.append(line)
	except:
		EOFError
		break

total_sum = 0
for line in arr:
	if line.count("|") == len(line):
		total_sum += len(line) * 42

	else:
		price_tags = line.split(",-")
		total_sum += int(price_tags[0]) * len(price_tags[1])

final_price_buf = total_sum % 10

if final_price_buf != 0:
	total_sum += 10 - final_price_buf

print(total_sum,",-",sep="")

