#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a <<= 1;
  b <<= 1;
  int r1 = (x1 + y1) / a, r2 = (x2 + y2) / a, r3 = (x1 - y1) / b,
      r4 = (x2 - y2) / b;
  if (x1 + y1 < 0) r1 -= 1;
  if (x2 + y2 < 0) r2 -= 1;
  if (x1 - y1 < 0) r3 -= 1;
  if (x2 - y2 < 0) r4 -= 1;
  r1 = abs(r1 - r2);
  r3 = abs(r3 - r4);
  int res = min(r1, r3) + abs(r3 - r1);
  cout << res << "\n";
  return 0;
}
