#include <bits/stdc++.h>
#define int long long
using namespace std;

typedef long long ll;
const ll mod = 1e8+7;

ll mod_pow(ll x,ll n){
  ll res=1;
  while(n){
    if(n%2) res=res*x%mod;
    x=x*x%mod;
    n/=2;
  }
  return res;
}

ll divi(ll a,ll b){
  return a * mod_pow(b,mod-2) % mod;
}

ll factorial(int i){
  static vector<ll> k(1e6);
  if(!k[0]){k[0]=1;for(int i=1;i<(int)k.size();i++)k[i]=i*k[i-1]%mod;}
  return k[i];
}

ll nCr(ll n,ll r){
  ll a = mod_pow( factorial(r) * factorial(n-r) % mod ,mod-2);
  return factorial(n) * a % mod;
}

typedef pair<int,int> P;

int h, w, sy, sx, ty, tx;

P cal(int y, int x){
  
  int Y = abs(y - sy);
  int X = abs(x - sx);
  
  return P( Y + X, nCr( Y + X, X ));
}

void solve(){
  
  map<int,int> ans;

  for(int i=-1;i<=1;i++){
    
    for(int j=-1;j<=1;j++){
      
      P tmp = cal( ty + i * h, tx + j * w );

      ans[tmp.first] += tmp.second;
      
      ans[tmp.first] %= mod;
    }
    
  }
  
  auto p = ans.begin();
  
  cout<<(*p).second<<endl;
}

signed main(){
  
  cin>>h>>w;
  
  cin>>sy>>sx>>ty>>tx;
  
  solve();  
  
  return 0;
}

