#include <bits/stdc++.h>
using namespace std;
long long Abs(long long x) {
  if (x < 0) return -x;
  return x;
}
int Solve0(long long x0, long long y0, long long x1, long long y1,
           long long a) {
  x0 += y0;
  x1 += y1;
  if (x0 > x1) swap(x0, x1);
  if (x0 < 0) {
    long long tmp = ((-x0) / (2 * a) + 1) * 2 * a;
    x0 += tmp;
    x1 += tmp;
  }
  x1 -= (x1 % (2 * a));
  if (x1 < x0) return 0;
  return 1 + Abs(x1 - x0) / (2 * a);
}
int Solve1(long long x0, long long y0, long long x1, long long y1,
           long long a) {
  x0 -= y0;
  x1 -= y1;
  if (x0 > x1) swap(x0, x1);
  if (x0 < 0) {
    long long tmp = ((-x0) / (2 * a) + 1) * 2 * a;
    x0 += tmp;
    x1 += tmp;
  }
  x1 -= (x1 % (2 * a));
  if (x1 < x0) return 0;
  return 1 + Abs(x1 - x0) / (2 * a);
}
int main() {
  long long a, b, x0, y0, x1, y1;
  cin >> a >> b >> x0 >> y0 >> x1 >> y1;
  cout << max(Solve0(x0, y0, x1, y1, a), Solve1(x0, y0, x1, y1, b));
  return 0;
}
