import math

cash = 0

while True:
    try:
        string = input()

        if string[0] == '|':
            cash += len(string)*42
        else:
            price, amount = string.split(',')
            cash += int(price)*len(amount[1:])
    except:
        break

print(str(math.ceil(cash/10)*10)+",-")
