#include <bits/stdc++.h>
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 i, j, s1, s2, r1, r2;
  s1 = x1 + y1;
  s2 = x2 + y2;
  r1 = 0;
  r2 = 0;
  if (s1 < 0) r1 = 1;
  if (s2 < 0) r2 = 1;
  i = fabs(s1 / a - r1 - s2 / a + r2);
  s1 = x1 - y1;
  s2 = x2 - y2;
  r1 = 0;
  r2 = 0;
  if (s1 < 0) r1 = 1;
  if (s2 < 0) r2 = 1;
  j = fabs(s1 / b - r1 - s2 / b + r2);
  if (i > j)
    printf("%d", i);
  else
    printf("%d", j);
  return 0;
}
