CMIMC 2017 Number Theory Problem 8

Let N be the number of ordered triples (a, b, c) \in\{1, \ldots, 2016\}^{3} such that a^{2}+b^{2}+c^{2} \equiv 0 (mod 2017). What are the last three digits of N?