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

#GL0000249. Tổng bội chung nhỏ nhất (LCM Sum)

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 (LCM Sum)

LCM Sum

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer nn, calculate S(n)=∑i=1nlcm⁡(i,n)S(n)=\sum_{i=1}^n\operatorname{lcm}(i,n). Print the exact integer, without taking a modulus.

Input

Read one integer nn.

Output

Print the exact value S(n)S(n).

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100.
  • Subtask 2 (30 points): 1≤n≤100001\le n\le 10000.
  • Subtask 3 (50 points): 1≤n≤10000001\le n\le 1000000.

Examples

Example 1

Input

1

Output

1

Explanation

For n=1n=1, the least common multiples are 1, totaling 1.

Example 2

Input

2

Output

4

Explanation

For n=2n=2, the least common multiples are 2, 2, totaling 4.

Example 3

Input

5

Output

55

Explanation

For n=5n=5, the least common multiples are 5, 10, 15, 20, 5, totaling 55.