Circle Grid Points
A circle centered at the origin is given by
\[ x^2 + y^2 = R^2 \]
It turns out that it is possible to determine how many points are on the circumference of the circle that have both integer \(x\) and \(y\) coordinates, depending on the radius \(R\).
In this problem we want to determine the sum of the smallest and the largest radius that are less than 1000, such that the circles with these radii intersect the grid (i.e. the intersection point has both integer \(x\) and \(y\) coordinates) at exactly 36 distinct points.