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