#abc259e. [abc259_e]LCM on Whiteboard
[abc259_e]LCM on Whiteboard
Problem Statement
There are integers written on a whiteboard.
Here, can be represented as $a_i = p_{i,1}^{e_{i,1}} \\times \\ldots \\times p_{i,m_i}^{e_{i,m_i}}$ using prime numbers and positive integers .
You will choose one of the integers to replace it with .
Find the number of values that can be the least common multiple of the integers after the replacement.
Constraints
- $2 \\leq p_{i,1} \\lt \\ldots \\lt p_{i,m_i} \\leq 10^9$
- is prime.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
1
7 2
2
2 2
5 1
1
5 1
2
2 1
7 1
Sample Output 1
3
The integers on the whiteboard are $a_1 =7^2=49, a_2=2^2 \\times 5^1 = 20, a_3 = 5^1 = 5, a_4=2^1 \\times 7^1 = 14$.
If you replace with , the integers on the whiteboard become , whose least common multiple is .
If you replace with , the integers on the whiteboard become , whose least common multiple is .
If you replace with , the integers on the whiteboard become , whose least common multiple is .
If you replace with , the integers on the whiteboard become , whose least common multiple is .
Therefore, the least common multiple of the integers after the replacement can be , , or , so the answer is .
Sample Input 2
1
1
998244353 1000000000
Sample Output 2
1
There may be enormous integers on the whiteboard.