#include <bits/stdc++.h>
using namespace std;
long long Max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long Min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long myfloor(long long a, long long b) {
  if (a % b == 0) return a / b;
  return a > 0 ? a / b : a / b - 1LL;
}
int main() {
  long long a, b, x1, x2, y1, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long s1 = x1 + y1, s2 = x2 + y2;
  long long mmin = Min(s1, s2);
  long long mmax = Max(s1, s2);
  long long ans1 = myfloor(mmax, (2 * a)) - myfloor((mmin), (2 * a));
  s1 = x1 - y1, s2 = x2 - y2;
  mmin = Min(s1, s2);
  mmax = Max(s1, s2);
  long long ans2 = myfloor(mmax, (2 * b)) - myfloor((mmin), (2 * b));
  long long ans = Max(ans1, ans2);
  cout << Max(ans, 0LL) << endl;
}
