#include <bits/stdc++.h>
using namespace std;
int a, b, x, y, xx, yy, xv, xh, xxv, xxh;
int main() {
  cin >> a >> b >> x >> y >> xx >> yy;
  if (x + y >= 0) xh = (x + y) / (a * 2);
  if (x + y < 0) xh = (x + y) / (a * 2) - 1;
  if (x - y <= 0) xv = (y - x) / (2 * b);
  if (x - y > 0) xv = (y - x) / (2 * b) - 1;
  if (xx + yy >= 0) xxh = (xx + yy) / (a * 2);
  if (xx + yy < 0) xxh = (xx + yy) / (a * 2) - 1;
  if (xx - yy <= 0) xxv = (yy - xx) / (2 * b);
  if (xx - yy > 0) xxv = (yy - xx) / (2 * b) - 1;
  cout << max(abs(xxh - xh), abs(xxv - xv));
}
