#include <bits/stdc++.h>
using namespace std;
long long a, b, x, y, xx, yy;
int main() {
  cin >> a >> b >> x >> y >> xx >> yy;
  long long A, AA, B, BB;
  if (x + y >= 0)
    A = (x + y) / (2 * a);
  else
    A = -(-(x + y) / (2 * a)) - 1;
  if (xx + yy >= 0)
    AA = (xx + yy) / (2 * a);
  else
    AA = -(-(xx + yy) / (2 * a)) - 1;
  if (x - y >= 0)
    B = (x - y) / (2 * b);
  else
    B = -(-(x - y) / (2 * b)) - 1;
  if (xx - yy >= 0)
    BB = (xx - yy) / (2 * b);
  else
    BB = -(-(xx - yy) / (2 * b)) - 1;
  cout << max(abs(A - AA), abs(B - BB));
}
