import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Bill {
    private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static Integer BEER_COST = 42;

    private static Integer parseAndCompute(String str) {
        if (str.startsWith("|")) {
            return BEER_COST * countOfRakeDents(str);
        } else {
            String[] parts = str.split(",-");
            Integer cost = Integer.parseInt(parts[0]);
            if (parts.length == 1) {
                return cost;
            }
            return cost * countOfRakeDents(parts[1]);
        }
    }

    private static Integer countOfRakeDents(String str) {
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '|') {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) throws IOException {
        Integer result = 0;
        String line = reader.readLine();
        while (line != null) {
            if (line.isEmpty()) {
                break;
            }
            result += parseAndCompute(line);
            line = reader.readLine();
        }
        Integer resultWithLastDigitZero = (result / 10) * 10;
        int lastDigit = result - resultWithLastDigitZero;
        if (lastDigit >= 1) {
            System.out.println(resultWithLastDigitZero + 10 + ",-");
        } else {
            System.out.println(resultWithLastDigitZero + ",-");
        }
    }
}

