WA in ICL802

solution:https://www.codechef.com/viewsolution/17558988
what is wrong with solution?
It would be nice if someone can point out the error.

Thanks in advance.

Update numerator in each step, otherwise it will depend on the precision.