cswork / OAOpen practice workspace

FortinetOA #2

Checksum Aggregator

Estimated HardJudge-ready

Topics (AI-labelled)Bits & Math

Over all ordered index pairs with 1≤i,j≤n, sum C(i,j)=i mod j+j mod i, modulo 1,000,000,007. The statement requires the two indices to be distinct; diagonal terms are zero.

Input

A single integer n (1≤n≤1000000).

Output

Output the sum of the checksum over all distinct ordered pairs, modulo 1000000007.

Example 1

Input:

1

Output:

0

Example 2

Input:

2

Output:

2

Example 3

Input:

3

Output:

10

Example notes

For each fixed j, split the remainders over 1..n into complete periods and a tail.

Editorial

Loading solution…