#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long yellow_id = (x1 - y1) / (2 * b);
  if (x1 - y1 < 0) yellow_id--;
  long long yellow_id2 = (x2 - y2) / (2 * b);
  if (x2 - y2 < 0) yellow_id2--;
  long long blue_id = (x1 + y1) / (2 * a);
  if (x1 + y1 < 0) blue_id--;
  long long blue_id2 = (x2 + y2) / (2 * a);
  if (x2 + y2 < 0) blue_id2--;
  long long n = abs(yellow_id - yellow_id2);
  long long m = abs(blue_id - blue_id2);
  cout << max(n, m) << "\n";
}
