import math

bill = 0

while True:
    try:
        line = input()
    except:
        break

    # if len(line) == 0:
    #     break
    # print(line[0])
    if (line[0] == '|'):
        bill+= 42 * len(line)
    else:
        tmp = line.split(",-")
        price = tmp[0]
        count = len(tmp[1])
        bill+= int(price) * count

if bill % 10 != 0:
    bill += (10 - bill % 10)
print(str(bill)+",-")

