#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans, sum, tmp;
int MAX, MIN;
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long dx, dy;
  dx = abs((x1 + y1) / (2 * a) - (x2 + y2) / (2 * a));
  if ((x1 + y1) * (x2 + y2) < 0) dx++;
  dy = abs((x1 - y1) / (2 * b) - (x2 - y2) / (2 * b));
  if ((x1 - y1) * (x2 - y2) < 0) dy++;
  cout << max(dx, dy);
}
