#include <bits/stdc++.h>
using namespace std;
long long aabs(long long a) {
  if (a < 0)
    return -a;
  else
    return a;
}
long long a, b, x1, x2, aasdfasdfasdf, y2, s1, s2, ans;
int main() {
  cin >> a >> b;
  cin >> x1 >> aasdfasdfasdf >> x2 >> y2;
  s1 = (x1 + aasdfasdfasdf + 2000000000ll * 2 * a) / (2 * a);
  s2 = (y2 + x2 + 2000000000ll * 2 * a) / (2 * a);
  ans = aabs(s1 - s2);
  s1 = (x1 - aasdfasdfasdf + 2000000000ll * 2 * b) / (2 * b);
  s2 = (x2 - y2 + 2000000000ll * 2 * b) / (2 * b);
  ans = max(ans, aabs(s1 - s2));
  cout << ans << endl;
  cin.get();
  cin.get();
  return 0;
}
