#P1581. A+B Problem(升级版)

    ID: 569 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>模拟字符串高精度素数判断,质数,筛法

A+B Problem(升级版)

Description

Here, A+BA+B works in a peculiar way. Carries follow the sequence of prime bases. For example: 1,0+2,11,0+2,1 = 1,0,11,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 ss of the form 1,0+2,11,0+2,1.

Output Format

Output the result of the addition.

1,0+2,1
1,0,1

Hint

Translated by ChatGPT 5