#include <bits/stdc++.h>
using namespace std;
using namespace std;
inline long long gcd(long long a, long long b) {
  return b ? gcd(b, a % b) : a;
};
const long long mod = 1e9 + 9;
long long QPow(long long a, long long b) {
  long long as = 1;
  if (b < 0) return 0;
  while (b) {
    if (b & 1) as = as * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return as;
}
const long long maxn = 4e6 + 5;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t, n, k, a, b, m, len, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long mn = min(x1 + y1, x2 + y2);
  long long mx = max(x1 + y1, x2 + y2);
  long long ans = (mx / (2 * a) - (mx < 0)) - ((mn) / (2 * a) - (mn < 0));
  mn = min(y1 - x1, y2 - x2);
  mx = max(y1 - x1, y2 - x2);
  a = b;
  ans = max((mx / (2 * a) - (mx < 0)) - ((mn) / (2 * a) - (mn < 0)), ans);
  cout << ans << endl;
  return 0;
}
