#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 310;
int main() {
  int a, b, x1, x2, y1, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a *= 2, b *= 2;
  int X1 = x1 + y1;
  int Y1 = y1 - x1;
  int X2 = x2 + y2;
  int Y2 = y2 - x2;
  x1 = X1 / a + (X1 > 0);
  x2 = X2 / a + (X2 > 0);
  y1 = Y1 / b + (Y1 > 0);
  y2 = Y2 / b + (Y2 > 0);
  printf("%d\n", max(abs(x1 - x2), abs(y1 - y2)));
  return 0;
}
