#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1.);
template <class T>
inline T sq(T x) {
  return x * x;
}
template <class T>
inline void upd_min(T &lhs, T rhs) {
  if (lhs > rhs) lhs = rhs;
}
template <class T>
inline void upd_max(T &lhs, T rhs) {
  if (lhs < rhs) lhs = rhs;
}
void solve() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long p = x1 + y1;
  long long q = x2 + y2;
  long long r = x1 - y1;
  long long s = x2 - y2;
  long long _p = p - (((p) % (2 * a) + (2 * a)) % (2 * a));
  long long _q = q - (((q) % (2 * a) + (2 * a)) % (2 * a));
  long long _r = r - (((r) % (2 * b) + (2 * b)) % (2 * b));
  long long _s = s - (((s) % (2 * b) + (2 * b)) % (2 * b));
  long long cand1 = abs(_p - _q) / (2 * a);
  long long cand2 = abs(_r - _s) / (2 * b);
  cout << max(cand1, cand2) << endl;
}
int main() {
  solve();
  return 0;
}
