#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  int A = 0, B = 0;
  A = x1;
  B = y1;
  x1 = A + B;
  y1 = B - A;
  A = x2;
  B = y2;
  x2 = A + B;
  y2 = B - A;
  a = a * 2;
  b = 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));
  return 0;
}
