#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include using namespace std; const int MOD=1e9+7; map dp1[205][205],dp2[205][205]; int main(){ int h,w; cin>>h>>w; vector S(h); rep(i,h) cin>>S[i]; if(h==1 && w==1){ cout<<1<s) break; if(is) break; swap(S[i][j],S[h-1-i][w-1-j]); } } rep(i,h){ rep(j,w){ if(i+j>s) break; if(i=w) continue; map m2; if(h-i-2>=0) for(auto [a,b]:dp2[h-1-i-1][w-1-j]) m2[a]=(m2[a]+b)%MOD; if(w-j-2>=0) for(auto [a,b]:dp2[h-1-i][w-1-j-1]) m2[a]=(m2[a]+b)%MOD; for(auto [a,b]:dp1[i][j]) ans=(ans+b*m2[a]%MOD)%MOD; } cout<s) break; if(is) break; swap(S[i][j],S[h-1-i][w-1-j]); } } rep(i,h){ rep(j,w){ if(i+j>s) break; if(i=w) continue; map m1,m2; if(i-1>=0) for(auto [a,b]:dp1[i-1][j]) m1[a]=(m1[a]+b)%MOD; if(j-1>=0) for(auto [a,b]:dp1[i][j-1]) m1[a]=(m1[a]+b)%MOD; if(h-i-2>=0) for(auto [a,b]:dp2[h-1-i-1][w-1-j]) m2[a]=(m2[a]+b)%MOD; if(w-j-2>=0) for(auto [a,b]:dp2[h-1-i][w-1-j-1]) m2[a]=(m2[a]+b)%MOD; for(auto [a,b]:m1) ans=(ans+b*m2[a]%MOD)%MOD; } cout<