#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long A, B, x1, y1, x2, y2;
  cin >> A >> B >> x1 >> y1 >> x2 >> y2;
  A *= 2;
  B *= 2;
  long long s1 = x1 + y1;
  long long s2 = x2 + y2;
  if (s1 > s2) swap(s1, s2);
  long long tmp = s1 % A;
  if (s1 < 0)
    s1 += fabs(tmp);
  else
    s1 += A - fabs(tmp);
  tmp = s2 % A;
  if (s2 < 0)
    s2 -= A - fabs(tmp);
  else
    s2 -= fabs(tmp);
  long long res = 0LL;
  if (s1 <= s2) res += fabs(s2 - s1) / A + 1;
  long long t1 = x1 - y1;
  long long t2 = x2 - y2;
  if (t1 > t2) swap(t1, t2);
  tmp = t1 % B;
  if (t1 < 0)
    t1 += fabs(tmp);
  else
    t1 += B - fabs(tmp);
  tmp = t2 % B;
  if (t2 < 0)
    t2 -= B - fabs(tmp);
  else
    t2 -= fabs(tmp);
  if (t1 <= t2) res = max(res, (long long)fabs(t2 - t1) / B + 1);
  cout << res << endl;
  return 0;
}
