#include <bits/stdc++.h>
using namespace std;
bool solve(int& tc) {
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  int lr = (x1 + y1) / (2 * a) + (x1 + y1 < 0 ? -1 : 0);
  int lc = (x1 - y1) / (2 * b) + (x1 - y1 < 0 ? -1 : 0);
  int rr = (x2 + y2) / (2 * a) + (x2 + y2 < 0 ? -1 : 0);
  int rc = (x2 - y2) / (2 * b) + (x2 - y2 < 0 ? -1 : 0);
  cout << max(abs(rr - lr), abs(rc - lc)) << endl;
  return false;
}
int main() {
  int n = 1 << 30;
  if (!n) cin >> n;
  for (int i = 0; i < n && solve(i); ++i)
    ;
  return 0;
}
