#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:300000000")
using namespace std;
const double pi = 3.1415926535897932384626433832795;
template <class T>
T myabs(T a) {
  return a >= 0 ? a : -a;
};
template <class T>
T sqr(T x) {
  return x * x;
}
void rot(long long &x, long long &y) {
  long long bufx = x - y;
  long long bufy = x + y;
  x = bufx;
  y = bufy;
}
void dodiv(long long &x, long long a) {
  long long r = x / a;
  if (x < 0) r--;
  x = r;
}
int main() {
  long long a, b;
  long long x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a *= 2, b *= 2;
  rot(x1, y1);
  rot(x2, y2);
  dodiv(x1, b);
  dodiv(x2, b);
  dodiv(y1, a);
  dodiv(y2, a);
  cout << max(myabs(x1 - x2), myabs(y1 - y2));
}
