#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double EPS = 1e-9, INF = 1e12;
long long calc(int a, long long p, long long q) {
  if (p > q) swap(p, q);
  if (p < 0) {
    q += (abs(p) + a - 1) / a * a;
    p += (abs(p) + a - 1) / a * a;
  }
  return q / a - p / a;
}
int main() {
  int a, b, x, y, X, Y;
  cin >> a >> b >> x >> y >> X >> Y;
  long long c = calc(2 * a, x + y, X + Y), d = calc(2 * b, x - y, X - Y);
  cout << max(c, d) << endl;
  return 0;
}
