#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long a, b;
  long long sx, sy;
  long long gx, gy;
  cin >> a >> b >> sx >> sy >> gx >> gy;
  long long sr = (sx + sy) / 2 / a;
  if (sx + sy < 0) sr--;
  long long sl = (sx - sy) / 2 / b;
  if (sx - sy < 0) sl--;
  long long gr = (gx + gy) / 2 / a;
  if (gx + gy < 0) gr--;
  long long gl = (gx - gy) / 2 / b;
  if (gx - gy < 0) gl--;
  long long res = 1234567890LL;
  long long tmp1 = sr - gr;
  if (tmp1 < 0) tmp1 = -tmp1;
  long long tmp2 = sl - gl;
  if (tmp2 < 0) tmp2 = -tmp2;
  res = max(tmp1, tmp2);
  cout << res << endl;
  return 0;
}
