Her is the link to my submission on which i got WA at pretest 11 https://mirror.codeforces.com/contest/1139/submission/51643042
I just uncommented the line ans=(ans+mod)%mod and it got accpeted although in the previous line i had done ans=(? -ans +mod)%mod.
Someone please explain me why did my code failed at test 11 ?