#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2;
  int x, y;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  x = x1, y = y1;
  x1 = x + y, y1 = x - y;
  x = x2, y = y2;
  x2 = x + y, y2 = x - y;
  a *= 2, b *= 2;
  x1 = x1 / a + (x1 > 0);
  x2 = x2 / a + (x2 > 0);
  y1 = y1 / b + (y1 > 0);
  y2 = y2 / b + (y2 > 0);
  cout << max(abs(x1 - x2), abs(y1 - y2)) << endl;
  getchar();
  return 0;
}
