Robot Paths codechef question

Link : https://www.codechef.com/problems/CD1IT4

Here is my code for the function

int f(int a[][100],int r,int c)
{
if(r==0 && c==0)
return 1;

if(a[r-1][c]==-1 && c==0)
return 0;

if(a[r][c-1]==-1 && r==0)
return 0;

if(a[r-1][c]==-1 && a[r][c-1]==-1)
return 0;

if(a[r-1][c]==-1 || r==0)
return f(a,r,c-1);

if(a[r][c-1]==-1 || c==0)
return f(a,r-1,c);

return f(a,r-1,c)+f(a,r,c-1);
}

// -1 represents a blocked cell

I am getting slightly different answer in all test cases. Please tell the error.