PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000266. Tổng hàm phi Euler (Sum of Totient Function)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tổng hàm phi Euler (Sum of Totient Function)

Sum of Totient Function

Source: Library Checker

Version: Phuoc Hung OJ Extended

Problem Statement

Euler’s totient function φ(x)\varphi(x) counts the integers kk satisfying 1≤k≤x1\le k\le x and gcd⁡(k,x)=1\gcd(k,x)=1. In particular, φ(1)=1\varphi(1)=1. Given a positive integer NN, compute ∑i=1Nφ(i)\sum_{i=1}^{N}\varphi(i) modulo 998244353998244353.

Input

One line contains the positive integer NN.

Output

Print one integer: the required sum modulo 998244353998244353.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1041\le N\le 10^4.
  • Subtask 2 (30 points): 1≤N≤1071\le N\le 10^7.
  • Subtask 3 (50 points): 1≤N≤10101\le N\le 10^{10}.

Examples

Input

5

Output

10

Explanation

For N=5N=5, φ(1)=1\varphi(1)=1, φ(2)=1\varphi(2)=1, φ(3)=2\varphi(3)=2, φ(4)=2\varphi(4)=2, and φ(5)=4\varphi(5)=4. Their sum is 1010, so the output is 10.