#include <bits/stdc++.h>
using namespace std;
int a, b, x1, x2, y11, y2;
int f(int x, int c) {
  if (x >= 1)
    return (x - 1) / c;
  else
    return x / c - 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b >> x1 >> y11 >> x2 >> y2;
  x1 = x1 + y11;
  y11 = x1 - 2 * y11;
  x2 = x2 + y2;
  y2 = x2 - 2 * y2;
  cout << max(abs(f(x1, 2 * a) - f(x2, 2 * a)),
              abs(f(y11, 2 * b) - f(y2, 2 * b)));
  return 0;
}
