from sys import stdin

bill = 0

for ln in stdin:
    c = ln.strip().split(',-')
    if not c:
        continue
    if len(c) == 1:
        bill += 42 * len(c[0])
    elif len(c[1]) < 1:
        bill += int(c[0])
    else:
        bill += int(c[0]) * len(c[1])

print(bill + 10-(bill%10))

