#include <bits/stdc++.h>
using namespace std;
int g[100][100];
int ceil(int a, int b) {
  if (a >= 0) return a / b;
  if (a % b == 0)
    return a / b;
  else
    return a / b - 1;
}
void oku() {
  int n, a, b, x1, y1, x2, y2;
  memset(g, 0, sizeof g);
  n = 30;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a *= 2;
  b *= 2;
  int x, y;
  int t1 = ceil(x1 + y1, a);
  int t2 = ceil(x1 - y1, b);
  int t3 = ceil(x2 + y2, a);
  int t4 = ceil(x2 - y2, b);
  cout << max(abs(t1 - t3), abs(t2 - t4));
}
int main() {
  oku();
  return 0;
}
