#include <bits/stdc++.h>
inline int dist(int a, int b, int d) {
  assert(a % d && b % d);
  if (a >= 0)
    a /= d;
  else
    a = a / d - 1;
  if (b >= 0)
    b /= d;
  else
    b = b / d - 1;
  return abs(a - b);
}
int main() {
  int a, b, x1, y1, x2, y2;
  scanf("%d%d%d%d%d%d", &a, &b, &x1, &y1, &x2, &y2);
  printf("%d\n",
         ((dist(x1 + y1, x2 + y2, 2 * a)) > (dist(x1 - y1, x2 - y2, 2 * b))
              ? (dist(x1 + y1, x2 + y2, 2 * a))
              : (dist(x1 - y1, x2 - y2, 2 * b))));
  return 0;
}
