#include <bits/stdc++.h>
using namespace std;
inline int sgn(int x) { return x < 0 ? -1 : 1; }
inline int cntbetween(int x, int y, int d) {
  return sgn(x) == sgn(y) ? abs(x / d - y / d) : 1 + abs(x / d) + abs(y / d);
}
int main() {
  int a, b, x1, y1, x2, y2;
  scanf("%d %d %d %d %d %d", &a, &b, &x1, &y1, &x2, &y2);
  a *= 2;
  b *= 2;
  int s1 = x1 + y1, s2 = x2 + y2, d1 = x1 - y1, d2 = x2 - y2;
  int sdif = cntbetween(s1, s2, a), ddif = cntbetween(d1, d2, b);
  printf("%d\n", max(sdif, ddif));
  return 0;
}
