#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
int main() {
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  int xx1 = abs(x1 + y1) / (2 * a);
  if (x1 + y1 < 0) xx1 = -xx1 - 1;
  int yy1 = abs(x1 - y1) / (2 * b);
  if (x1 - y1 < 0) yy1 = -yy1 - 1;
  int xx2 = abs(x2 + y2) / (2 * a);
  if (x2 + y2 < 0) xx2 = -xx2 - 1;
  int yy2 = abs(x2 - y2) / (2 * b);
  if (x2 - y2 < 0) yy2 = -yy2 - 1;
  cout << max(abs(xx1 - xx2), abs(yy1 - yy2)) << endl;
  return 0;
}
