diophantine equations in hill cipher decryption
i've got a question abouut 'collecting like terms'.
im tryinng to solve 125x+26y=1
by using euclid's algorithms i got:
125= 4x26 +21
26= 1x21 +5
21= 4x5 +1
GCD is 1
but now i have to work backwards because my original question was to decrypt my hill cipher message. (i know how to work this out with the inverse matrices etc its just this one step im stuck on):
1= 21-4x5 < ---- (from the last line)
= 21-4x (26-1x21) <---- (i substituted 5 from the 2nd line)
now, im meant to collect like terms together but i dont know how? the next line is meant to be 5x21-4x26, but how do i get that?