#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x1, x2, y1, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long h1 = x1 + y1, hh1 = y1 - x1, h2 = x2 + y2, hh2 = y2 - x2;
  a *= 2;
  b *= 2;
  long long ans1 = 0, ans2 = 0;
  if (h1 * h2 <= 0) ans1++;
  if (hh1 * hh2 <= 0) ans2++;
  ans1 += max(h1 / a - h2 / a, h2 / a - h1 / a);
  ans2 += max(hh1 / b - hh2 / b, hh2 / b - hh1 / b);
  cout << max(ans1, ans2) << endl;
}
