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

#GL0000270. Tổng bội chung nhỏ nhất – Bản khó (LCM Sum (Hard))

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng bội chung nhỏ nhất – Bản khó (LCM Sum (Hard))

LCM Sum (Hard)

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer nn, let Li=lcm⁡(i,n)L_i=\operatorname{lcm}(i,n) be the least common multiple of ii and nn, for every integer 1≤i≤n1\le i\le n. Compute ∑i=1nLi\sum_{i=1}^{n}L_i modulo 109+710^9+7.

Input

One line contains the positive integer nn.

Output

Print one integer: the required sum modulo 10000000071000000007.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1061\le n\le 10^6.
  • Subtask 2 (30 points): 1≤n≤10121\le n\le 10^{12}.
  • Subtask 3 (50 points): 1≤n≤10181\le n\le 10^{18}.

Examples

Input

5

Output

55

Explanation

For n=5n=5, the LCM values for i=1,2,3,4,5i=1,2,3,4,5 are 5,10,15,20,55,10,15,20,5. Their sum is 5555, so the output is 55.