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