An Easy One From The 2012 Singapore Math Olympiad

image containing math problem statement
Here is a fairly easy problem from the Singapore Math Olympiad of 2012.
We know
$1021 \equiv -2\ mod\ (1023)$

Also,
$(-2)^{10} = 1024 \equiv 1\ (mod\ 1023)$

Therefore,
$1021^{10} \equiv 1\ (mod\ 1023)$

Also,
$1021^{1022} = 1021^{1020} \times 1021^{2}$

$= \left(1021^{10} \right)^{102} \times 1021^{2}$

$\equiv 1 \times 1021^2\ (mod\ 1023)$

$\equiv (-2)^2 \ (mod\ 1023)$

$\equiv 4 \ (mod\ 1023)$

Therefore, the remainder is $4$.