#include <bits/stdc++.h>
using namespace std;
int A, B, X1, Y1, X2, Y2;
int input() {
  cin >> A >> B >> X1 >> Y1 >> X2 >> Y2;
  return 0;
}
int solve() {
  int t1, t2, t3;
  t1 = abs(((X1 + Y1) / (2 * A)) - ((X2 + Y2) / (2 * A)));
  t2 = abs(((X1 - Y1) / (2 * B)) - ((X2 - Y2) / (2 * B)));
  if (((X1 - Y1) >= 0 && (X2 - Y2) <= 0) || ((X1 - Y1) <= 0 && (X2 - Y2) >= 0))
    t2++;
  if (((X1 + Y1) >= 0 && (X2 + Y2) <= 0) || ((X1 + Y1) <= 0 && (X2 + Y2) >= 0))
    t1++;
  return max(t1, t2);
}
int main() {
  input();
  cout << solve() << endl;
  return 0;
}
