#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e8+7;
ll add(ll a,ll b){
  return (a+b)%mod;
}
ll mul(ll a,ll b){
  return (a*b)%mod;
}
ll mpow(ll a,ll b){
  if(b==0)return 1;
  ll res=mpow( mul(a,a) , b/2);
  if(b&1)res=mul(res,a);
  return res;
}
ll divi(ll a,ll b){
  return mul(a, mpow(b,mod-2) );
}

ll fact[10000];
ll nCr(ll n,ll r){
  return divi( fact[n] , mul(fact[r],fact[n-r]));
}


ll H,W,a,b,x,y;

int main(){
  fact[0]=1;
  for(int i=1;i<10000;i++)fact[i]=mul(fact[i-1],i);
  cin>>W>>H>>a>>b>>x>>y;
  ll dx=min( abs(a-x) , W - abs(a-x) );
  ll dy=min( abs(b-y) , H - abs(b-y) );
  ll ans=nCr(dx+dy,dx);
  if( abs(a-x)*2 == W ) ans=mul(ans,2);
  if( abs(b-y)*2 == H ) ans=mul(ans,2);
  cout<<ans<<endl;
  return 0;
}