#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  int xa = (x1 + y1) / (a * 2) + (x1 + y1 > 0);
  int xb = (x2 + y2) / (a * 2) + (x2 + y2 > 0);
  int ya = (y1 - x1) / (b * 2) + (y1 - x1 > 0);
  int yb = (y2 - x2) / (b * 2) + (y2 - x2 > 0);
  if (abs(yb - ya) > abs(xb - xa))
    cout << abs(yb - ya);
  else
    cout << abs(xb - xa);
}
