DIGROT - NEED HELP..

sum 1 plz help…heres my solution …seem’s to be working for all test cases,but still showing wrong answer…http://www.codechef.com/viewsolution/4102672