#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-5;
template <typename T>
T abs(const T& a) {
  if (a >= 0) return a;
  return -a;
}
int main() {
  ios::sync_with_stdio(false);
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  int a1 = floor((x1 + y1) / double(a * 2));
  int a2 = floor((x2 + y2) / double(a * 2));
  int b1 = floor((x1 - y1) / double(b * 2));
  int b2 = floor((x2 - y2) / double(b * 2));
  cout << max(abs(a1 - a2), abs(b1 - b2)) << '\n';
  return 0;
}
