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