#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2;
  scanf("%d%d%d%d%d%d", &a, &b, &x1, &y1, &x2, &y2);
  int a1 = (x1 + y1) / (2 * a);
  if (((x1 + y1) % (2 * a) != 0 && (x1 + y1) < 0)) a1--;
  int a2 = (x2 + y2) / (2 * a);
  if (((x2 + y2) % (2 * a) != 0 && (x2 + y2) < 0)) a2--;
  int b1 = (x1 - y1) / (2 * b);
  if (((x1 - y1) % (2 * b) != 0 && (x1 - y1) < 0)) b1--;
  int b2 = (x2 - y2) / (2 * b);
  if (((x2 + y2) % (2 * b) != 0 && (x2 - y2) < 0)) b2--;
  int d1 = abs(a1 - a2), d2 = abs(b1 - b2);
  printf("%d\n", max(d1, d2));
  return 0;
}
