x ≡ (−2)2007 ≡ 0 (mod 8)
x ≡ (−2)2007 ≡ −128 ≡ 123 (mod 251)
From the first equivalence, we see that x is of the form 8k for some integer k. We can
substitute this into the second equivalence and solve:
Solution was written by Sean Soni and compiled from Art of Problem Solving Forums.