I've been reading this great blog and tried to solve B. Troynacci Query but I couldn't :( . I already tried to reading its editorial but it contained the equations directly for coding ! I couldn't understand how the equations were derived , and please :
A- I need help to solve the above problem .
B- Can I do all operations and apply modulo at the end when printing only , like :
print : OUTPUT%mod ?
C- I need problems like this to solve .