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