#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long cross(long long xx1, long long xx2, long long aa) {
  if (xx1 * xx2 <= 0)
    return abs(xx1) / aa + abs(xx2) / aa + 1;
  else
    return abs((xx1) / aa - (xx2) / aa);
}
int main() {
  long long x1, y1, x2, y2, xx1, xx2, yy1, yy2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long res = 0;
  res = cross(x1 + y1, x2 + y2, 2 * a);
  res = max(res, cross(x1 - y1, x2 - y2, 2 * b));
  cout << res << endl;
  return 0;
}
