#P8588. 『JROI-8』雷雨天特别行动科
『JROI-8』雷雨天特别行动科
Background

"Angels do not have vacations."
"Ah, again... It is better not to push yourself too hard."
Reprint authorization has been obtained.
Problem Description
For a non-negative integer variable , define one round of operations as follows:
- Increase by .
- If is a multiple of , divide by .
Given the initial and , find the value of after rounds of operations.
Note: The large sample is not provided as an attached file. Instead, it is placed directly in Sample #3 of the Input/Output Samples.
Input Format
One line with two non-negative integers .
Output Format
One line with one positive integer, representing the value of after rounds of operations.
1 3
2
10 3
5
1919810 3
213313
Hint
[Sample Explanation]
For Sample 1, the change process of is as follows: $1\rightarrow 2\rightarrow (3\rightarrow 1)\rightarrow 2$.
The part in parentheses represents one operation.
[Constraints and Notes]
For all testdata, .
In particular, in test points , is equivalent to , and similarly for in .
| Test Point ID | Score | ||
|---|---|---|---|
Translated by ChatGPT 5