#abc212g. [abc212_g]Power Pair
[abc212_g]Power Pair
Problem Statement
Given is a prime number .
How many pairs of integers satisfy the following conditions?
- There exists a positive integer such that .
Since the answer may be enormous, print it modulo .
Constraints
- is a prime number.
Input
Input is given from Standard Input in the following format:
Output
Print the answer modulo .
Sample Input 1
3
Sample Output 1
4
Four pairs satisfy the conditions.
Sample Input 2
11
Sample Output 2
64
Sample Input 3
998244353
Sample Output 3
329133417