#include <bits/stdc++.h>
using namespace std;
long long divrd(long long a, long long b) {
  long long c = a / b;
  if (c * b > a) c--;
  return c;
}
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long xpy1 = x1 + y1, xpy2 = x2 + y2;
  long long xmy1 = x1 - y1, xmy2 = x2 - y2;
  cout << max(labs(divrd(xpy1, 2 * a) - divrd(xpy2, 2 * a)),
              labs(divrd(xmy1, 2 * b) - divrd(xmy2, 2 * b)))
       << endl;
  return 0;
}
