#include <bits/stdc++.h>
using namespace std;
using VS = vector<string>;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
using VL = vector<LL>;
using VVL = vector<VL>;
const int INF = 1e9;
const LL LINF = 1e16;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
int DX[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int DY[8] = {1, -1, 0, 0, 1, -1, 1, -1};
LL N;
LL ans = 0LL;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int a, b, x[2], y[2];
  cin >> a >> b;
  for (int(i) = (0); (i) < (2); (i)++) cin >> x[i] >> y[i];
  int X[2], Y[2];
  for (int(i) = (0); (i) < (2); (i)++) {
    X[i] = x[i] - y[i];
    Y[i] = x[i] + y[i];
  }
  a *= 2;
  b *= 2;
  int nx[2], ny[2];
  for (int(i) = (0); (i) < (2); (i)++) {
    nx[i] = X[i] / b + (X[i] > 0);
    ny[i] = Y[i] / a + (Y[i] > 0);
  }
  ans = max(abs(ny[0] - ny[1]), abs(nx[0] - nx[1]));
  cout << ans << "\n";
  return 0;
}
