#include <bits/stdc++.h>
using namespace std;
long long f(int x, int y) { return abs((x) / y); }
long long solve(long long x1, long long x2, long long b) {
  if (x1 > x2) swap(x1, x2);
  long long ans = 0;
  ans += x2 / b;
  if (x1 <= 0)
    ans += abs(x1) / b;
  else
    ans -= (x1 - 1) / b;
  if (x2 >= 0 && x1 <= 0) ans++;
  return ans;
}
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a <<= 1, b <<= 1;
  long long xr = (x1 + y1), yr = (x1 - y1);
  long long xp = (x2 + y2), yp = (x2 - y2);
  cout << max(solve(xr, xp, a), solve(yr, yp, b)) << endl;
}
