#include <bits/stdc++.h>
using namespace std;
long long Solve(long long n, long long m) {
  long long r = n / m;
  if (n < 0) r = (n - m + 1) / m;
  return r;
}
int main() {
  int a, b, x1, y1, x2, y2;
  scanf("%d %d %d %d %d %d", &a, &b, &x1, &y1, &x2, &y2);
  long long a1 = Solve(x1 + y1, 2 * a);
  long long a2 = Solve(x2 + y2, 2 * a);
  long long b1 = Solve(x1 - y1, 2 * b);
  long long b2 = Solve(x2 - y2, 2 * b);
  long long da = abs(a1 - a2);
  long long db = abs(b1 - b2);
  printf("%I64d\n", max(da, db));
  return 0;
}
