7. Let $S=\{(x, y) \mid x, y \in \mathbb{Z}, 0 \leq x, y, \leq 2016\}$. Given points $A=\left(x_{1}, y_{1}\right), B=\left(x_{2}, y_{2}\right)$ in $S$, define
$$
d_{2017}(A, B)=\left(x_{1}-x_{2}\right)^{2}+\left(y_{1}-y_{2}\right)^{2} \quad(\bmod 2017) \text {. }
$$

The points $A=(5,5), B=(2,6), C=(7,11)$ all lie in $S$. There is also a point $O \in S$ that satisfies
$$
d_{2017}(O, A)=d_{2017}(O, B)=d_{2017}(O, C) \text {. }
$$

Find $d_{2017}(O, A)$.
Answer:
1021
Note that the triangle is a right triangle with right angle at $A$. Therefore, $R^{2}=\frac{(7-2)^{2}+(11-6)^{2}}{4}=\frac{25}{2}=$ $(25)\left(2^{-1}\right) \equiv 1021(\bmod 2017)$. (An equivalent approach works for general triangles; the fact that the triangle is right simply makes the circumradius slightly easier to compute.)