bill = list()
isEnd = False
counter = 0

while not isEnd:
    s = input()
    if s == "":
        isEnd = True
    else:
        bill.append(s)

for line in bill:
    if line[0] == "|":
        counter += len(line) * 42
    else:
        parts = line.split(",-")
        counter += int(parts[0]) * len(parts[1])

if str(counter)[-1] != '0':
    counter = round(counter / 10)
    counter *= 10

print(counter, end=",-")
