#include <iostream>

using namespace std;

int getLCM(int s, int t) {
  int tmp;

  if (s < t) {
    tmp = t;
    t = s;
    s = tmp;
  }
  while (s % t != 0) {
    tmp = s % t;
    s = t;
    t = tmp;
  }
  return t;
}

int main(int argc, char *argv[]) {
  int r, c, a1, a2, b1, b2;
  cin >> r >> c >> a1 >> a2 >> b1 >> b2;

  int hoge = 1;
  int x;
  if (a1 > b1)
    if (a1 - b1 < r - a1 + b1) {
      x = a1 - b1;
    } else if (a1 - b1 > r - a1 + b1) {
      x = r - a1 + b1;
    } else {
      x = a1 - b1;
      hoge *= 2;
    }
  else
    if (b1 - a1 < r - b1 + a1) {
      x = b1 - a1;
    } else if (b1 - a1 > r - b1 + a1) {
      x = r - b1 + a1;
    } else {
      x = b1 - a1;
      hoge *= 2;
    }
  int y;
  if (a2 > b2)
    if (a2 - b2 < c - a2 + b2) {
      y = a2 - b2;
    } else if (a2 - b2 > c - a2 + b2) {
      y = c - a2 + b2;
    } else {
      y = a2 - b2;
      hoge *= 2;
    }
  else
    if (b2 - a2 < c - b2 + a2) {
      y = b2 - a2;
    } else if (b2 - a2 > c - b2 + a2) {
      y = c - b2 + a2;
    } else {
      y = b2 - a2;
      hoge *= 2;
    }

  int *deno, *nume;
  deno = new int[x];
  nume = new int[x];
  for (int i = 0; i < x; i++) {
    nume[i] = x + y - i;
    deno[i] = x - i;
  }
  for (int i = 0; i < x; i++)
    for (int j = 0; j < x; j++) {
      int lcm = getLCM(nume[i], deno[j]);
      nume[i] /= lcm;
      deno[j] /= lcm;
    }
  /*                                                                                                                                                                                                                                                                                                                                              
  for (int i = 0; i < x; i++)                                                                                                                                                                                                                                                                                                                     
    cout << nume[i] << endl;                                                                                                                                                                                                                                                                                                                      
  for (int i = 0; i < x; i++)                                                                                                                                                                                                                                                                                                                     
    cout << deno[i] << endl;                                                                                                                                                                                                                                                                                                                      
  */
  long long result = 1;
  for (int i = 0; i < x; i++) {
    result *= nume[i];
    if (result > 100000007)
      result %= 100000007;
  }

  result = result * hoge % 100000007;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1188