#include <bits/stdc++.h>
double const PI = 4 * atan(1.0);
using namespace std;
int main() {
  long long a, b, x1, y1, x2, y2;
  scanf("%I64d %I64d %I64d %I64d %I64d %I64d", &a, &b, &x1, &y1, &x2, &y2);
  a = 2 * a;
  b = 2 * b;
  long long t1 = (x1 + y1);
  long long t2 = (x2 + y2);
  long long g1 = (x1 - y1);
  long long g2 = (x2 - y2);
  if (t1 < 0)
    t1 = t1 / a - 1;
  else
    t1 = t1 / a;
  if (t2 < 0)
    t2 = t2 / a - 1;
  else
    t2 = t2 / a;
  if (g1 < 0)
    g1 = g1 / b - 1;
  else
    g1 = g1 / b;
  if (g2 < 0)
    g2 = g2 / b - 1;
  else
    g2 = g2 / b;
  printf("%I64d", max(abs(t1 - t2), abs(g1 - g2)));
}
