[Algorithm] Count the squares

All taken from the exam:
CONTESTS COMPUTING NATIONAL CHILD XIX th - 2013, TABLE B TEST SUBJECT - HIGH SCHOOL FACILITIES.

[qads]

Threads:

For a square table size n × n grid is divided into units, the
the peak position of the unit squares are called mesh. People want to count
squares correspond to the amount of the following two conditions:
+/ Each square next to one of two parallel edges table
+/ Both 4 vertices of the square to stay in the position of the mesh
For example, the table size 3 × 3 I can count 14 squares satisfy two conditions.
So count the number of squares can be very large, so I just need to know the results of the balance
division: count the number of squares divided by the 2013.
You need to create a file named SQUARES.TXT results include 10 current, Each line contains a single integer
especially Findings (balance divided by the number of squares counted for 2013) to a price
n values ​​below.

Count the squares

Explanation see page 2