#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, xx, yy, a, b, k1, k2, kk1, kk2;
  scanf("%d%d %d%d %d%d", &a, &b, &x, &y, &xx, &yy);
  k1 = (x + y) / (2 * a);
  if (x + y < 0) k1--;
  k2 = (x - y) / (2 * b);
  if (x - y < 0) k2--;
  kk1 = (xx + yy) / (2 * a);
  if (xx + yy < 0) kk1--;
  kk2 = (xx - yy) / (2 * b);
  if (xx - yy < 0) kk2--;
  printf("%d\n", max(abs(k1 - kk1), abs(k2 - kk2)));
  return 0;
}
