Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and between (r-1, f) and (0, f) at a cost of 1. At this time, find the number of routes that can be moved from the first coordinate to the second coordinate at the shortest cost.



Input

The input is given in the following format.


r c a1 a2 b1 b2


Input meets the following constraints
1 ≤ r, c ≤ 1,000
0 ≤ a1, b1 <r
0 ≤ a2, b2 <c

Output

Output the remainder of the answer value divided by 100,000,007.

Examples

Input

4 4 0 0 3 3


Output

2


Input

4 4 0 0 1 1


Output

2


Input

2 3 0 0 1 2


Output

4


Input

500 500 0 0 200 200


Output

34807775
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<ll,ll> P;
typedef std::pair<ll,P> State;

const ll MOD = 100000007;

// 2 3 -> (1, -1, 1)
// 6 27 -> (3, -4, 1)
State extgcd(ll a, ll b){
    if(b == 0){
        return mp(a, mp(1, 0));
    }
    State s = extgcd(b, a%b);
    P p = s.second;
    return mp(s.first, mp(p.second, p.first-(a/b)*p.second));
}

// 3 7 -> 5
// 11 7 -> 2
ll mod_inverse(ll a, ll m){
    State s = extgcd(a, m);
    return (m + s.second.first % m) % m;
}

ll fact[2001];
P mod_fact(ll n, ll p){
    if(n == 0){return mp(1, 0);}

    ll e = n / p;
    P small = mod_fact(n/p, p);
    e += small.second;

    if(n / p % 2 == 0){return mp(small.first * fact[n%p] % p, e);}
    return mp(small.first * (p - fact[n%p]) % p, e);
}

ll mod_combination(ll n, ll k, ll p){
    if(n < 0 || k < 0 || n < k){return 0;}
    P p1 = mod_fact(n, p), p2 = mod_fact(k, p), p3 = mod_fact(n-k, p);
    if(p1.second > p2.second + p3.second){return 0;}
    return p1.first * mod_inverse(p2.first * p3.first % p, p) % p;
}

int main(){
    fact[0] = 1;
    FOR(i, 1, 2001){
        fact[i] = (fact[i-1] * i) % MOD;
    }

    int r, c, a1, a2, b1, b2;
    std::cin >> r >> c >> a1 >> a2 >> b1 >> b2;

    if(a1 > b1){std::swap(a1, b1);}
    if(a2 > b2){std::swap(a2, b2);}

    int dx[2] = {b1-a1, a1+r-b1}, dy[2] = {b2-a2, a2+c-b2};
    
    int shortestPath = INF;
    
    REP(i, 2){
        REP(j, 2){
            shortestPath = std::min(shortestPath, dx[i]+dy[j]);
        }
    }

    ll res = 0;
    REP(i, 2){
        REP(j, 2){
            if(dx[i] + dy[j] == shortestPath){
                res = (res + mod_combination(dx[i]+dy[j], dx[i], MOD)) % MOD;
            }
        }
    }

    std::cout << res << std::endl;
}