#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long Ans1 = 1, Ans2 = 1;
  long long x = x1 + y1;
  long long y = x2 + y2;
  if (x > y) swap(x, y);
  a *= 2;
  if (x <= 0)
    Ans1 -= x / a;
  else
    Ans1 -= x / a + 1;
  if (y < 0)
    Ans1 += y / a - 1;
  else
    Ans1 += y / a;
  b *= 2;
  x = x1 - y1;
  y = x2 - y2;
  if (x > y) swap(x, y);
  if (x <= 0)
    Ans2 -= x / b;
  else
    Ans2 -= x / b + 1;
  if (y < 0)
    Ans2 += y / b - 1;
  else
    Ans2 += y / b;
  int Ans = max(Ans1, Ans2);
  if (Ans1 == Ans2 && Ans1 == 0) Ans = 0;
  cout << Ans << endl;
  return 0;
}
