#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2, k1, k2, k3, k4, n1, n2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  k1 = (x1 + y1) / (2 * a);
  if (x1 + y1 < 0) k1--;
  k2 = (x2 + y2) / (2 * a);
  if (x2 + y2 < 0) k2--;
  k3 = (x1 - y1) / (2 * b);
  if (x1 - y1 < 0) k3--;
  k4 = (x2 - y2) / (2 * b);
  if (x2 - y2 < 0) k4--;
  n1 = abs(k1 - k2);
  n2 = abs(k3 - k4);
  cout << max(n1, n2);
  return 0;
}
