Hmm, couldn't find a very concise summary of modular arithmetic. Basically what you need to know is that one can write equations where one only cares if the remainder to some division is the same. For example

since all numbers have the same remainder w.r.t. division by 10. Note that also

since in general you can add or subtract any multiple of 10 (in this case).
Now some rule are, that for you can replace any integer by another which gives the same remainder. For example

as you can check for yourself.
You can do this in equations also at any instant of the calculation

where in some steps I replaced number by their remainder w.r.t. division by 10 (which is basically the last digit of the number)
That what I did for your problem

where I replaced 2 with the "equivalent" remainder-wise -1.