#include <cassert>
#include <algorithm>
#include <iostream>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const int MOD = 100 * 1000 * 1000 + 7;

ll dp[2001][2001];

ll comb(int n, int k) {
    assert(n >= k);
    assert(n > 0);

    if (dp[n][k] > 0) {
        return dp[n][k];
    } else if (k == 1) {
        return n;
    } else if (k == 0) {
        return 1;
    } else if (n == k) {
        return 1;
    }

    dp[n][k] = (comb(n - 1, k - 1) + comb(n - 1, k)) % MOD;
    return dp[n][k];
}

int main(void) {
    int r, c, a1, a2, b1, b2;
    cin >> r >> c >> a1 >> a2 >> b1 >> b2;

    int m = min(abs(b1 - a1), r - abs(b1 - a1));
    int n = min(abs(b2 - a2), c - abs(b2 - a2));

    ll answer = comb(m + n, m);
    if (r % 2 == 0 && m == r / 2) {
        answer = 2 * answer % MOD;
    }
    if (c % 2 == 0 && n == c / 2) {
        answer = 2 * answer % MOD;
    }
    cout << answer << endl;
    
    return 0;
}

