https://www.codechef.com/viewsolution/28414872

But still it is saying that it is wrong…
please let me know where i am doing wrong!!

Hi @vidhu120 ,

One thing I could figure out is, you did not take Mod with 10^9 + 7
Which might cause integer overflow & hence Wrong Answer.

Actually i didn’t get the exact meaning of this statement so could you please elaborate on how exactly i should take mod with 10^9 + 7 ??

change line 29 to cout << c%1000000007 << endl;

@vidhu120 mod \space 10^9+7 means you must take modulo 10^9+7 of your answer before printout your answer. It’s taking to protect integer overflow.
Take modulo as follows: `ans % 1000000007`

Details here

i did the mod part too but still it is saying that it is wrong…if someone can please point out the problem, that would be great …