#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll FLO(ll a, ll b) { return a + b; }
int main() {
  double a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  ll shell1 = floor((x1 + y1) / (a + a));
  ll shell2 = floor((x2 + y2) / (a + a));
  ll gap1 = floor((x1 - y1) / (b + b));
  ll gap2 = floor((x2 - y2) / (b + b));
  cout << max(abs(shell1 - shell2), abs(gap1 - gap2)) << endl;
}
