#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>
#include <cstring>

typedef long long ll;

using namespace std;

ll nCr[2000][2000] = {0};

int main(void){
	for(int i=1; i<1010; ++i){
		nCr[i][0] = nCr[i][i] = 1;
	}
	for(int i=2; i<1010; ++i){
		for(int j=1; j<i; ++j){
			nCr[i][j] = (nCr[i-1][j-1] + nCr[i-1][j]) % 100000007;
		}
	}

	int r, c, a1, a2, b1, b2;
	int min_1, min_2, coef = 1;
	cin >> r >> c >> a1 >> a2 >> b1 >> b2;

	min_1 = min(abs(a1-b1), r-abs(a1-b1));
	min_2 = min(abs(a2-b2), c-abs(a2-b2));

	if(abs(a1-b1) == r-abs(a1-b1)) coef *= 2;
	if(abs(a2-b2) == c-abs(a2-b2)) coef *= 2;

	int res;

	if(min_1+min_2 == 0){
		res = 1;
	} else {
		res =(coef * (int)nCr[min_1+min_2][min_2]) % 100000007 ;
	}

	cout << res << endl;

	return 0;
}