SIGFPE in EGYPTFRA(ACM12 Kanpur online)

I am not able to find where is divide by zero occuring in my solution.

http://www.codechef.com/viewsolution/2708006