#include <bits/stdc++.h>
using namespace std;
const long long LINF = ~(((long long)0x1) << 63) / 2;
const int INF = 0X3F3F3F3F;
const double eps = 1e-7;
int main() {
  long long a, b, x1, y1, x2, y2;
  long long ans = 0;
  long long mina, minb, maxa, maxb;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a *= 2;
  b *= 2;
  mina = x1 + y1;
  maxa = x2 + y2;
  minb = x1 - y1;
  maxb = x2 - y2;
  int xa, ya, xb, yb;
  xa = abs(mina / a - maxa / a);
  if (mina * maxa <= 0) xa++;
  xb = abs(minb / b - maxb / b);
  if (minb * maxb <= 0) xb++;
  cout << max(xa, xb) << endl;
}
