#include <bits/stdc++.h>
using namespace std;
inline long long lambda(long long x, long long y) {
  return x >= 0 ? x / y : floor((double)x / y);
}
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a *= 2;
  b *= 2;
  long long res = 0;
  long long resa = abs(lambda((x1 + y1), a) - lambda((x2 + y2), a));
  long long resb = abs(lambda((x1 - y1), b) - lambda((x2 - y2), b));
  res = resa > resb ? resa : resb;
  cout << res;
}
