import math

price = 0
while True:
	try:
		line = input()
		if line[0] == '|':
			price += len(line) * 42
			print(len(line))
		else:
			a, b = line.split(',-')
			print(int(a), len(b))
			price += int(a) * len(b)
	except:
		break
print('{},-'.format(math.ceil(price / 10) * 10))

