ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

2220. Reciprocal of GCD

Time limit: 1.5 second
Memory limit: 512 MB
Many have heard of and used the operation of finding the greatest common divisor. This operation is usually written as GCD(n, m). But this time, Vadim decided to consider numbers that are the reciprocals of the GCD, that is, numbers equal to 1 / GCD(n, m).
These numbers intrigued Vadim greatly, and he decided to calculate the reciprocal of the GCD for all pairs of numbers from 1 to N. Unfortunately, this is a very time-consuming task, so Vadim asks you to help find the arithmetic mean of all these values.

Input

A single line contains an integer N (1 ≤ N ≤ 107).

Output

Output the answer to the problem modulo 109 + 7. That is, if your answer is represented as an irreducible fraction p/q, then output an integer x such that 0 ≤ x ≤ 109 + 6 and p q · x   (mod  109 + 7).

Samples

inputoutput
2
833333340
3
805555562
1
1

Notes

In the first example, there are three GCDs: GCD(1, 1) = 1, GCD(1, 2) = 1, GCD(2, 2) = 2. The arithmetic mean of the reciprocals of these GCDs is:
(1/1 + 1/1 + 1/2) / 3 = 5 / 6
6 · 833333340 = 5000000040 = 5 · (10^9 + 7) + 5 ≡ 5   (mod  109 + 7)
Problem Author: Vadim Barinov
Problem Source: ICPC Ural Regional Contest Qualifier 2025