Wrong answer in FLOW005

I have checked the code on codeblocks .Its working perfecly there but i am getting wrong answer on codechef.Here’s my solution :solution

Use long long int for variables, check constraints.