#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  int k1 = (x1 + y1) / (2 * a) + (x1 + y1 < 0 ? -1 : 0);
  int k2 = (x1 - y1) / (2 * b) + (x1 - y1 < 0 ? -1 : 0);
  int k3 = (x2 + y2) / (2 * a) + (x2 + y2 < 0 ? -1 : 0);
  int k4 = (x2 - y2) / (2 * b) + (x2 - y2 < 0 ? -1 : 0);
  int ans = max(abs(k1 - k3), abs(k2 - k4));
  cout << ans << endl;
  return 0;
}
