#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAX = 1000;
const int inf = 999999999;
const int p1 = 104393321, p2 = 104393329;
int a, b, x, y, xp, yp;
int Div(int q, int w) {
  if (q >= 0)
    return q / w;
  else
    return q / w + (-1);
}
int main() {
  ios::sync_with_stdio(0);
  cin >> a >> b >> x >> y >> xp >> yp;
  a *= 2, b *= 2;
  int f = abs(Div(x + y, a) - Div(xp + yp, a));
  int s = abs(Div(x - y, b) - Div(xp - yp, b));
  cout << max(f, s) << endl;
  return 0;
}
