DRANGE_Wrong Ans

I have tried a number of test cases but i still i cant figure out my mistake.Please help.Code link is below :
http://www.codechef.com/viewsolution/2403899

Also when i was through some of the successful submissions of other users i saw that they have stored the variables with constraints around a lakh with “int”.How is this possible ?

Well, here, int is a 32-bit integer.

So, the range of numbers is from -231 to 231-1.

Which is -2,147,483,648 to 2,147,483,647.

So all numbers within this range can be stored in an int.

2^31 is 2,147,483,648, not 4,294,967,296

Oops! Right. Will edit right away.

so will it work in other questions as well on codechef ??

Also someone please answer my first question also.

@dkrdharmesh >> Easy formula, if the input constraints as well as your calculation involving these inputs are within 10^9 then you’re okay with int otherwise you will have to use some larger data type.

Ok.But please answer my first question also.

What is your first question?

what is the mistake in the code link mentioned above ?