#include <bits/stdc++.h>
using namespace std;
using ll = long long;
tuple<ll, ll> t45(ll x, ll y) { return {x + y, x - y}; }
ll nsec(ll x, ll y, ll k) {
  if (x > y) swap(x, y);
  return int(floor(double(y) / k) - floor(double(x + k - 1) / k) + 1.2);
}
ll a, b, x[2], y[2];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a >> b;
  for (int i = (0); i < (2); i++) cin >> x[i] >> y[i];
  for (int i = (0); i < (2); i++) tie(x[i], y[i]) = t45(x[i], y[i]);
  ll seca = nsec(x[0], x[1], 2 * a), secb = nsec(y[0], y[1], 2 * b);
  cout << max(seca, secb) << "\n";
}
