#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-6;
double pi = acos(-1);
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
long long mcount(long long y1, long long y2, long long MOD) {
  MOD *= 2;
  y1 = (y1 - (y1 % MOD + MOD) % MOD) / MOD;
  y2 = (y2 - (y2 % MOD + MOD) % MOD) / MOD;
  return llabs(y2 - y1);
}
int main() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  cout << max(mcount(y1 + x1, y2 + x2, a), mcount(y1 - x1, y2 - x2, b)) << endl;
}
