#include <bits/stdc++.h>
using namespace std;
const long long MAXN = -1;
long long a, b, xa, xb, ya, yb;
pair<long long, long long> getCuad(long long x, long long y) {
  if (x > 0 && -x < y && y < x) return {-1, 1};
  if (x < 0 && x < y && y < -x) return {1, -1};
  if (y < 0 && y < x && x < -y) return {-1, -1};
  if (y > 0 && -y < x && x < y) return {1, 1};
  assert(false);
}
pair<long long, long long> getCoord(long long x, long long y) {
  pair<long long, long long> M = getCuad(x, y);
  int X = abs(x + y) / a;
  int Y = abs(x - y) / b;
  X = X - (M.first == -1 ? 1 : 0);
  Y = Y - (M.second == -1 ? 1 : 0);
  return make_pair(X, Y);
}
void floordiv(int x, int y, int &q, int &r) {
  q = x / y;
  r = x % y;
  if ((r != 0) && (r < 0) != (y < 0)) q--, r += y;
}
int main() {
  while (scanf("%lld%lld%lld%lld%lld%lld", &a, &b, &xa, &ya, &xb, &yb) >= 1) {
    a *= 2;
    b *= 2;
    int q1, r1;
    floordiv(xa + ya, a, q1, r1);
    int q2, r2;
    floordiv(xa - ya, b, q2, r2);
    int q3, r3;
    floordiv(xb + yb, a, q3, r3);
    int q4, r4;
    floordiv(xb - yb, b, q4, r4);
    int v1 = abs(q1 - q3);
    int v2 = abs(q2 - q4);
    printf("%d\n", max(v1, v2));
  }
  return 0;
}
