#include <bits/stdc++.h>
using namespace std;
const int N = 1e9;
int main() {
  long long a, b, x1, y1, x2, y2;
  scanf("%lld %lld %lld %lld %lld %lld", &a, &b, &x1, &y1, &x2, &y2);
  long long sum1 = x1 + y1, sum2 = x2 + y2;
  long long diff1 = x1 - y1, diff2 = x2 - y2;
  sum1 += N * 2 * a;
  sum2 += N * 2 * a;
  diff1 += N * 2 * b;
  diff2 += N * 2 * b;
  long long A1 = sum1 / (2 * a) + (sum1 % (2 * a) == 0);
  long long A2 = sum2 / (2 * a) + (sum2 % (2 * a) == 0);
  long long B1 = diff1 / (2 * b);
  long long B2 = diff2 / (2 * b);
  printf("%lld\n", max(abs(A1 - A2), abs(B1 - B2)));
  return 0;
}
