#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-10;
const long long add = 2000000000;
int main() {
  long long x1, y1, x2, y2, a, b;
  long long u1, v1, u2, v2;
  while (cin >> a >> b >> x1 >> y1 >> x2 >> y2) {
    v1 = (x1 - y1 + 2 * b - 1 + add * b) / (2 * b);
    v2 = (x2 - y2 + 2 * b - 1 + add * b) / (2 * b);
    u1 = (x1 + y1 + add * a) / (2 * a);
    u2 = (x2 + y2 + add * a) / (2 * a);
    long long dv = abs(v1 - v2);
    long long du = abs(u1 - u2);
    cout << max(dv, du) << endl;
  }
  return 0;
}
