#include <bits/stdc++.h>
using namespace std;
long long f(long long x, long long y) {
  if (x > 0) return x / y;
  int ret = x / y;
  if (x < 0) ret--;
  return ret;
}
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  assert(a >= 2 && b >= 2);
  assert((x1 - y1) % (2 * b) != 0);
  assert((x2 - y2) % (2 * b) != 0);
  long long a1 = abs(f(x1 + y1, 2 * a) - f(x2 + y2, 2 * a));
  long long a4 = abs(f(x1 - y1, 2 * b) - f(x2 - y2, 2 * b));
  cout << max(a1, a4) << endl;
  return 0;
}
