#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
long long f(long long aa, long long bb, long long c) {
  long long a = min(aa, bb), b = max(aa, bb);
  a += (inf / c) * c + c;
  b += (inf / c) * c + c;
  return (b / c - a / c);
}
int main() {
  long long k1, k2, a, b, x1, y1, x2, y2, ans;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  k1 = f(x1 + y1, x2 + y2, 2 * a);
  k2 = f(x1 - y1, x2 - y2, 2 * b);
  if (k1 < k2)
    ans = k2;
  else
    ans = k1;
  cout << ans;
  return 0;
}
