DIGROT - NEED HELP..

sum 1 plz help…heres my solution …seem’s to be working for all test cases,but still showing wrong answer…CodeChef: Practical coding for everyone