bill = list()
isEnd = False
counter = 0

while True:
    try:
        c = input()
        bill.append(c)
    except EOFError:
        break

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=",-\n")
