cswork / OA打开练习工作台

FortinetOA #2

Checksum Aggregator

估计困难可在线判题

考点(AI 标注)位运算

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.

输入格式

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

输出格式

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

样例 1

输入:

1

输出:

0

样例 2

输入:

2

输出:

2

样例 3

输入:

3

输出:

10

样例说明

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