Diwali puzzle Code not working

All sample test cases are passing but for test cases its giving wrong answer.What is wrong in the approach?
link-https://ide.codingblocks.com/s/237950

@amitrao at line 33 take modulo like this :-
answer=(answer+ rec(i,ct))%1000003;

@amitrao please mark the doubt as resolved after successfully submitting it.