#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = (long long)INF * INF;
long long a, b, x1, dsjkfkd, x2, y2;
long long part(long long x, long long c) { return x / (2 * c) - (x < 0); }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> a >> b >> x1 >> dsjkfkd >> x2 >> y2;
  cout << max(abs(part(x1 + dsjkfkd, a) - part(x2 + y2, a)),
              abs(part(x1 - dsjkfkd, b) - part(x2 - y2, b)));
  return 0;
}
