#include <bits/stdc++.h>
using namespace std;
int fl(int num, int denom) {
  int ans = num / denom;
  if (num < 0 && ans * denom != num) --ans;
  return ans;
}
int main() {
  int a, b, x[2], y[2], n[2], m[2], i, j, ans;
  scanf("%d%d", &a, &b);
  for (i = 0; i < 2; ++i) {
    scanf("%d%d", x + i, y + i);
    n[i] = fl(x[i] + y[i], 2 * a);
    m[i] = fl(-x[i] + y[i], 2 * b);
  }
  ans = max(abs(n[0] - n[1]), abs(m[0] - m[1]));
  printf("%d\n", ans);
  return 0;
}
