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