WA in CSEQ

Can anyone tell me what is wrong with my code ?

I followed the same thing given in editorial and got AC for 50 pts but WA in last subtask.

ans=-1 modulo MOD isn’t answer we expect to see:) Check this and feel the difference.

1 Like

Thank you a lot. I never thought the answer could be negative. Thanks