#include <bits/stdc++.h>
using namespace std;
inline long long floor(long long a, long long b) {
  if (a >= 0) return a / b;
  return -1 - ((-a) / b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(32);
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b;
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  long long ans = abs(floor(x1 + y1, 2 * a) - floor(x2 + y2, 2 * a));
  ans = max(ans, abs(floor(x1 - y1, 2 * b) - floor(x2 - y2, 2 * b)));
  cout << ans << '\n';
  return 0;
}
