Problem #218
Counting Hexagons
A regular hexagon with integer length n units is divided in 6n^2 equilateral triangles with sides of length 1 unit and this hexagonal lattice formed has a total of 3n^2 + 3n + 1 lattice points.
For n=3, refer to the image below
Let H(n) denote the number of regular hexagons that can be formed by connecting any 6 points. Let S(n) denote the summation of H(k) for 1 \le k \le n.
Given H(3) = 36 and S(10) = 7942, Calculate S(10^{18}).
Give your answer modulo 10^9+7.
Hint: Can you observe any pattern?