I can’t figure out what is wrong with this code .

#include<bits/stdc++.h>

#define mod 1000000007

#define ll long long

using namespace std;

void solve();

int main()

{

ios_base::sync_with_stdio(false);cin.tie(NULL);

#ifndef ONLINE_JUDGE

freopen(“input.txt”, “r”, stdin);

freopen(“error.txt”, “w”, stderr);

freopen(“output.txt”, “w”, stdout);

#endif

int t=1;

/*is Single Test case?*///cin>>t;

while(t–)

{

solve();

cout<<"\n";

}

cerr<<“time taken : “<<(float)clock()/CLOCKS_PER_SEC<<” secs”<<endl;

return 0;

}

void solve()

{

int n; cin>>n;

char a[n+1][n+1];

for (int i = 1; i <= n; ++i)

{

for (int j = 1; j <= n; ++j)

{

cin>>a[i][j];

}

}

// vector< vector > dp(n+1, vector (n+1, 0)); //initialising a 2d vector with all elements to 0

int dp[n+1][n+1];

```
for (int i = 0; i <= n+1; ++i)
{
for (int j = 0; j <= n+1; ++j)
{
dp[i][j] = 0;
}
}
if(a[n][n]!='*')
dp[n][n] = 1;
for (int i = n; i != 0; i--)
{
for (int j = n; j != 0; j--)
{
if(a[i][j] == '*'){
dp[i][j] = 0;
}
else{
if(i == n and j == n)
continue;
dp[i][j] += ((dp[i+1][j])%mod + (dp[i][j+1])%mod) %mod;
//cout<<dp[i][j]<<" ";
}
}
}
cout<<dp[1][1];
```

}

It is giving me wrong output for some test cases.

on this test case

10

…

…*.
…
…
…
…
…*…

…

*…*

……

…

…

this is giving me output 27560 instead of 27479

and some other test cases too.

Any help is appreciated.