#include <iostream>
#include <algorithm>
using namespace std;

typedef long long int lli;
const int MAX = 1001;
const lli MOD = 100000007;

int main(){
  int h,w,x1,y1,x2,y2;

  lli C[MAX][MAX];
  fill(C[0],C[MAX],1);
  for(int i=1;i<MAX;i++){
    for(int j=1;j<i;j++){
      C[i][j] = (C[i-1][j] + C[i-1][j-1]) % MOD;
    }
  }

  while(cin >> w >> h >> x1 >> y1 >> x2 >> y2){
    int x,y;
    lli ansx = 1, ansy = 1;
    if(abs(x2-x1) == abs(w-x2)+x1) ansx++;
    x = min(abs(x2-x1), abs(w-x2)+x1);
    if(x == abs(w-x1)+x2) ansx++;
    else if(x > abs(w-x1)+x2){
      ansx = 1;
      x = abs(w-x1)+x2;
    }

    if(abs(y2-y1) == abs(h-y2)+y1) ansy++;
    y = min(abs(y2-y1), abs(h-y2)+y1);
    if(y == abs(h-y1)+y2) ansy++;
    else if(y > abs(h-y1)+y2){
      ansy = 1;
      y = abs(h-y1)+y2;
    }
 
    cout << C[x+y][x] * ansx * ansy % MOD << endl;
  }
}