Fuzzy Factorization

#160
Made by: SBC 2025
1024MB
0.5s

Finding the prime factorization of big numbers is a challenging task. It is so difficult that the security of almost our entire digital world, from online banking to private messages, is built upon how hard it is. In this problem, you are asked to perform such a factorization, but some relative error is allowed in your answer.

More formally, you are given an integer $X$, and you have to provide the prime factorization of any number $Y=p_{1}^{e_{1}}\cdot p_{2}^{e_{2}}\cdot\cdot\cdot p_{k}^{e_{k}}$ such that:

  • the relative error of the factorization does not exceed $10^{-9}$ (that is, $\frac{|X-Y|}{X}\le10^{-9}$), and
  • each prime factor $p_{i}$ of $Y$ does not exceed $10^{18}$ (that is, $p_{i}\le10^{18}$ for $i=1,2,...,k$).

Input

The input consists of a single line that contains an integer $X$ $(2\le X\le10^{1000})$.

Output

The first line must contain a positive integer $k$ indicating the number of different prime factors in the prime factorization of $Y=p_{1}^{e_{1}}\cdot p_{2}^{e_{2}}\cdot\cdot\cdot p_{k}^{e_{k}}$.

The $i$-th of the next $k$ lines must contain the two positive integers $p_{i}$ and $e_{i}$, representing that $p_{i}$ is a prime factor of $Y$ with multiplicity $e_{i}$.

It can be proven that a valid answer exists under the given constraints. If there are multiple solutions, output any of them.


Input Example
Output Example
520
3
2 3
5 1
13 1

1073741825
5
5 2
13 1
41 1
61 1
1321 1