AtCoder Beginner Contest 212
G
Power Pair
AtCoder
⌀ 2150
原题
←H →
翻译中…

Problem Statement

翻译中…

Given is a prime number $P$.

翻译中…

How many pairs of integers $(x, y)$ satisfy the following conditions?

翻译中…
  • $0 \leq x \leq P-1$
  • $0 \leq y \leq P-1$
  • There exists a positive integer $n$ such that $x^n \equiv y \pmod{P}$.
翻译中…

Since the answer may be enormous, print it modulo $998244353$.

翻译中…

Constraints

翻译中…
  • $2 \leq P \leq 10^{12}$
  • $P$ is a prime number.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

P

翻译中…

Output

翻译中…

Print the answer modulo $998244353$.

翻译中…

样例

Input #1
3
Output #1
4
Four pairs $(x, y) = (0, 0), (1, 1), (2, 1), (2, 2)$ satisfy the conditions.
Input #2
11
Output #2
64
Input #3
998244353
Output #3
329133417
题目信息
题号
abc212_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。