import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Bill {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        long sum = 0;
        String s;
        while ((s = br.readLine()) != null)
        {
            if(s.charAt(0) == '|')
            {
                sum += 42*s.length();
            }
            else
            {
                String[] sP = new String[2];
                sP = s.split(",-");
                if(sP.length != 1)
                    sum += sP[1].length()*Integer.parseInt(sP[0]);
                else
                    sum += Integer.parseInt(sP[0]);
            }
        }
        if(sum%10 != 0)
        {
            sum += 10-sum%10;
        }
        System.out.println(sum+",-");
    }
    
}

