#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
int main() {
  long long a, b, x1, y1, x2, y2;
  while (cin >> a >> b >> x1 >> y1 >> x2 >> y2) {
    int a1 = (x1 + y1) / (2 * a), a2 = (x2 + y2) / (2 * a);
    int b1 = (x1 - y1) / (2 * b), b2 = (x2 - y2) / (2 * b);
    if (x1 + y1 < 0 && (x1 + y1) % (2 * a)) {
      --a1;
    }
    if (x2 + y2 < 0 && (x2 + y2) % (2 * a)) {
      --a2;
    }
    if (x1 - y1 < 0 && (x1 - y1) % (2 * b)) {
      --b1;
    }
    if (x2 - y2 < 0 && (x2 - y2) % (2 * b)) {
      --b2;
    }
    int aa = abs(a1 - a2);
    int bb = abs(b1 - b2);
    cout << max(aa, bb) << endl;
  }
  return 0;
  return 0;
}
