Wrong Answer-Egyption Fractions problem

I have been trying this problem for some days.The problem is

http://www.codechef.com/problems/EGYPTFRA/

My solution is http://www.codechef.com/viewsolution/2713870.

Approach:

For a fraction a/b, the largest fraction which can be subtracted is 1/ceil(b/a).(Greedy approach)

k=ceil(b/a)

The new fraction a’/b’=(kXa-b)/(kXb)

Am I wrong with this approach?

Looks like long long is not going to suffice. The range of inputs is way too large it seems from the solutions. No where are the constraints mentioned.

yes…the range is exceeding 10^18 in this question…

In the comments below the question(originally from ICPC Kanpur online round),constraints mentioned were for a,b<=1000