P1581 A+B Problem (Upgraded Version)

Background

Xiao Ming is doing his homework. There is an A+B Problem he cannot figure out, so he turns to you, a programmer, for help.

Description

Here, $A+B$ works in a peculiar way. Carries follow the sequence of prime bases. For example: $1,0+2,1$ = $1,0,1$ (using $\verb!,!$ to separate each digit). The units place uses base 2, the tens place uses base 3, the hundreds place uses base 5, the thousands place uses base 7, the ten-thousands place uses base 11, and so on. The highest place of the two addends is the ten-thousands place (the digit at this place may have two decimal digits, e.g., 10).

Input Format

Input a string $s$ of the form $1,0+2,1$.

Output Format

Output the result of the addition.

Explanation/Hint

Translated by ChatGPT 5