6. (3 points) In space, there is a cube $1000 \times 1000 \times 1000$ with a vertex at the origin and faces parallel to the coordinate planes. Vectors are drawn from the origin to all integer points inside and on the boundary of this cube. Find the remainder when the sum of the squares of the lengths of these vectors is divided by 13.

#