#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x1, y1, x2, y2;
  while (cin >> a >> b >> x1 >> y1 >> x2 >> y2) {
    a *= 2;
    b *= 2;
    long long ans = 0;
    long long xx1 = x1 + y1;
    long long xx2 = x1 - y1;
    long long yy1 = x2 + y2;
    long long yy2 = x2 - y2;
    long long t1 = xx1 / a - (xx1 < 0);
    long long t2 = xx2 / b - (xx2 < 0);
    long long tt1 = yy1 / a - (yy1 < 0);
    long long tt2 = yy2 / b - (yy2 < 0);
    ans += max(abs(t1 - tt1), abs(t2 - tt2));
    cout << ans << endl;
  }
  return 0;
}
