#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int main() {
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a *= 2, b *= 2;
  int B1 = y1 - x1;
  int B2 = y2 - x2;
  int A1 = y1 + x1;
  int A2 = y2 + x2;
  x1 = B1 / b + (B1 > 0);
  x2 = B2 / b + (B2 > 0);
  y1 = A1 / a + (A1 > 0);
  y2 = A2 / a + (A2 > 0);
  cout << max(abs(x2 - x1), abs(y2 - y1)) << endl;
  return 0;
}
