codeforces; solve "Modular Equations" from Round #282 (Div. 2)