#P8692. [蓝桥杯 2019 国 C] 数正方形

[蓝桥杯 2019 国 C] 数正方形

Problem Description

On an N×NN \times N lattice of points, choose 44 points that form exactly the four vertices of a square. How many different ways are there?

Since the result may be very large, you only need to output the remainder modulo 109+710^9 + 7.

As shown in the figure above, all these squares are valid.

Input Format

The input contains one integer NN.

Output Format

Output one integer representing the answer.

4
20

Hint

For all test cases, 2N1062 \le N \le 10^6.

Lanqiao Cup 2019 National Contest Group C, Problem G.

Translated by ChatGPT 5