Define the infinite sequence A as follows:
A_0 = 1,
A_i = A_{i/p} + A_{i/q}, \quad i \ge 1
Three integers n, p and q (0 \le n \le 10^{12},\ 2 \le p, q \le 10^9).
Print the value of A_n.
Example 1
Example 2