#P10186. [YDOI R1] Lattice
[YDOI R1] Lattice
Background
se likes lattices.
Problem Description
se has a square lattice, with as the bottom-left corner and as the top-right corner.
se also has a line with equation , where .
For any , suppose the line passes through lattice points. se's preference value for this line is .
se wants to know the sum of the preference values over all lines, modulo . Please tell se the answer.
Input Format
One line with one integer .
Output Format
Output one integer, representing the sum of preference values modulo .
2
6
1919810
107114211
Hint
Sample Explanation #1
When is , the line passes through the lattice point , and the preference value is . When is , the line passes through lattice points and , and the preference value is . When is , the line passes through the lattice point , and the preference value is . The sum of preference values is .
Constraints
This problem uses bundled testdata.
| Subtask ID | Score | |
|---|---|---|
For of the testdata, .
Translated by ChatGPT 5