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

    ID: 9627 远端评测题 1000ms 128MiB 尝试: 22 已通过: 7 显示难度普及 上传者: 标签>2019枚举组合数学蓝桥杯国赛

[蓝桥杯 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