#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, aa, bb, cc, dd, k, n, S, SS, SSS, ANS, m, kk, B, AAA, nn, N, M,
    M1, M2, M3, ANS1, ANS2, xx, yy, x, y;
double r, VV;
int main() {
  scanf("%d %d %d %d %d %d", &a, &b, &x, &y, &xx, &yy);
  a = a * 2;
  b = b * 2;
  if (((x + y) >= 0 && (xx + yy) >= 0) || ((x + y) <= 0 && (xx + yy) <= 0))
    ANS1 = abs(abs(x + y) / a - abs(xx + yy) / a);
  else
    ANS1 = abs(abs(x + y) / a + abs(xx + yy) / a) + 1;
  if (((x - y) >= 0 && (xx - yy) >= 0) || ((x - y) <= 0 && (xx - yy) <= 0))
    ANS2 = abs(abs(x - y) / b - abs(xx - yy) / b);
  else
    ANS2 = abs(abs(x - y) / b + abs(xx - yy) / b) + 1;
  printf("%d\n", max(ANS1, ANS2));
}
