#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-9;
int bit_count(int first) {
  return first == 0 ? 0 : 1 + bit_count(first & (first - 1));
}
inline int low_bit(int first) { return first & -first; }
inline int sign(double first) {
  return first < -EPS ? -1 : first > EPS ? 1 : 0;
}
inline int sign(int first) { return (first > 0) - (first < 0); }
inline int getInt() {
  int a;
  return scanf("%d", &a) ? a : (fprintf(stderr, "trying to read\n"), -1);
}
inline double getDouble() {
  double a;
  return scanf("%lf", &a) ? a : (fprintf(stderr, "trying to read\n"), -1.0);
}
inline double myRand() {
  return ((double)rand() / RAND_MAX) + ((double)rand() / RAND_MAX / RAND_MAX);
}
void myCode() {
  int a = 2 * getInt(), b = 2 * getInt(), x1 = getInt(), y1 = getInt(),
      x2 = getInt(), y2 = getInt();
  int m1 = x1 + y1, n1 = x1 - y1, m2 = x2 + y2, n2 = x2 - y2;
  printf("%d\n", max(abs((int)floor(1.0 * m1 / a) - (int)floor(1.0 * m2 / a)),
                     abs((int)floor(1.0 * n1 / b) - (int)floor(1.0 * n2 / b))));
}
int main() {
  srand(time(NULL));
  myCode();
  return 0;
}
