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