import fileinput


totalPrice = 0
for str in fileinput.input():
    str = str[:-1]
    if str != "":
        if str[0] == "|":
            totalPrice += len(str.split()) * 42
        else:
            price = int(str.split(",")[0])
            if (str[len(str) - 1] == "-"):
                totalPrice += price
            elif str.split("-")[1][0] != "|":
                totalPrice += int(str.split("-")[1]) * price
            else:
                totalPrice += len(str.split("-")[1].split()) * price
if (totalPrice % 10 == 0):
    print("{},-".format((totalPrice)))
else:
    print("{},-".format(((totalPrice // 10) * 10 + 10)))
