AtCoder Regular Contest 125
B
Squares
AtCoder
⌀ 1273
原题
← AC →
翻译中…

Problem Statement

翻译中…

You are given an integer $N$. Find the number of pairs of integers $(x, y)$ that satisfy the following conditions, modulo $998244353$.

翻译中…
  • $1 \leq x,y \leq N$.
  • $x^2-y$ is a square number. (Assume $0$ is also a square number.)
翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^{12}$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3
Output #1
2
We have the following two pairs. - $x=1,y=1$ - $x=2,y=3$
Input #2
10
Output #2
8
Input #3
10000000000
Output #3
52583544
题目信息
题号
arc125_b
时间限制
2 s
内存限制
1024 MB

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