#P10186. [YDOI R1] Lattice

    ID: 11403 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数论素数判断,质数,筛法莫比乌斯反演杜教筛

[YDOI R1] Lattice

Background

se likes lattices.

Problem Description

se has a square lattice, with (1,1)(1,1) as the bottom-left corner and (n,n)(n,n) as the top-right corner.

se also has a line with equation y=kxy=kx, where k(0,)k\in(0,\infty).

For any kk, suppose the line passes through cntcnt lattice points. se's preference value for this line is cnt2cnt^2.

se wants to know the sum of the preference values over all lines, modulo 109+710^9+7. Please tell se the answer.

Input Format

One line with one integer nn.

Output Format

Output one integer, representing the sum of preference values modulo 109+710^9+7.

2
6
1919810
107114211

Hint

Sample Explanation #1

When kk is 12\frac{1}{2}, the line passes through the lattice point (2,1)(2,1), and the preference value is 12=11^2=1. When kk is 11, the line passes through lattice points (1,1)(1,1) and (2,2)(2,2), and the preference value is 22=42^2=4. When kk is 22, the line passes through the lattice point (1,2)(1,2), and the preference value is 12=11^2=1. The sum of preference values is 1+4+1=61+4+1=6.

Constraints

This problem uses bundled testdata.

Subtask ID nn\le Score
11 88 55
22 10310^3 1515
33 10610^6 3030
44 23112^{31}-1 5050

For 100%100\% of the testdata, 1n23111\le n\le 2^{31}-1.

Translated by ChatGPT 5