#include <bits/stdc++.h>
using namespace std;
inline void tran(long long &x, long long &y) {
  long long x0 = x, y0 = y;
  x = x0 + y0, y = x0 - y0;
}
inline long long pos(long long x, long long d) { return x / d + (x > 0); }
inline long long LLabs(long long x) { return x > 0 ? x : -x; }
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  tran(x1, y1);
  tran(x2, y2);
  cout << max(LLabs(pos(x2, a * 2) - pos(x1, a * 2)),
              LLabs(pos(y2, b * 2) - pos(y1, b * 2)))
       << endl;
  return 0;
}
