#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2, c, d, x, y, z;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  x = x1 + y1, z = 0, y = x2 + y2, a *= 2, b *= 2;
  c = max(abs(x), abs(y)), c = c / a;
  d = min(abs(x), abs(y)), d = d / a;
  if ((x < 0 && y > 0) || (x > 0 && y < 0))
    c = c + d + 1;
  else
    c = c - d;
  z = max(z, c);
  x = x1 - y1, y = x2 - y2;
  c = max(abs(x), abs(y)), c = c / b;
  d = min(abs(x), abs(y)), d = d / b;
  if ((x < 0 && y > 0) || (x > 0 && y < 0))
    c = c + d + 1;
  else
    c = c - d;
  z = max(z, c);
  cout << z << endl;
  return 0;
}
