#include <bits/stdc++.h>
using namespace std;
int f(int a, int d) { return a / d - (a < 0); }
int main() {
  int a, b;
  int x1, y1;
  int x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  cout << max(abs(f(x1 + y1, 2 * a) - f(x2 + y2, 2 * a)),
              abs(f(x1 - y1, 2 * b) - f(x2 - y2, 2 * b)));
}
