#include <bits/stdc++.h>
using namespace std;
int Upper(int x, int y) {
  int ret = x / y;
  while ((long long)ret * y <= x) ret++;
  while ((long long)(ret - 1) * y > x) ret--;
  return ret;
}
int Lower(int x, int y) {
  int ret = x / y;
  while ((long long)ret * y >= x) ret--;
  while ((long long)(ret + 1) * y < x) ret++;
  return ret;
}
int main() {
  int a, b, x1, y1, x2, y2;
  scanf("%d%d%d%d%d%d", &a, &b, &x1, &y1, &x2, &y2);
  if (x1 == x2 && y1 == y2) {
    puts("1");
    return 0;
  }
  x1 = x1 - y1;
  y1 = x1 + y1 + y1;
  x2 = x2 - y2;
  y2 = x2 + y2 + y2;
  if (x1 > x2) {
    swap(x1, x2);
    swap(y1, y2);
  }
  if (y1 > y2) {
    y1 = -y1;
    y2 = -y2;
  }
  int s1 = 0, s2 = 0, k1 = Upper(y1, 2 * a), k2 = Lower(y2, 2 * a);
  if (k1 <= k2) {
    s1 = k2 - k1 + 1;
    y2 -= 2 * a * (k2 - k1 + 1);
  }
  k1 = Upper(x1, 2 * b), k2 = Lower(x2, 2 * b);
  if (k1 <= k2) {
    s2 = k2 - k1 + 1;
    x2 -= 2 * b * (k2 - k1 + 1);
  }
  int res = max(s1, s2);
  if (abs(x1) % (2 * b) == 0 || abs(y1) % (2 * a) == 0) res++;
  if (abs(x2) % (2 * b) == 0 || abs(y2) % (2 * a) == 0) res++;
  printf("%d\n", res);
  return 0;
}
