#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
void read(T &res) {
  bool flag = false;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (flag = true);
  for (res = ch - 48; isdigit(ch = getchar());
       res = (res << 1) + (res << 3) + ch - 48)
    ;
  flag && (res = -res);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long qp(long long a, long long b, long long mod) {
  long long ans = 1;
  if (b == 0) {
    return ans % mod;
  }
  while (b) {
    if (b % 2 == 1) {
      b--;
      ans = ans * a % mod;
    }
    a = a * a % mod;
    b = b / 2;
  }
  return ans % mod;
}
long long qpn(long long a, long long b, long long p) {
  long long ans = 1;
  a %= p;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % p;
      --b;
    }
    a = (a * a) % p;
    b >>= 1;
  }
  return ans % p;
}
struct pe {
  long long x;
  long long y;
  long long xx;
  long long yy;
  long long pasx;
  long long pasy;
} pos[3];
signed main() {
  long long a, b;
  read(a);
  read(b);
  a = a * 2;
  b = b * 2;
  for (long long i = 1; i <= 2; i++) {
    read(pos[i].x);
    read(pos[i].y);
    pos[i].xx = pos[i].x + pos[i].y;
    pos[i].yy = pos[i].y - pos[i].x;
  }
  for (long long i = 1; i <= 2; i++) {
    pos[i].pasx = pos[i].xx / (a);
    if (pos[i].xx > 0) {
      pos[i].pasx++;
    }
  }
  for (long long i = 1; i <= 2; i++) {
    pos[i].pasy = pos[i].yy / (b);
    if (pos[i].yy > 0) {
      pos[i].pasy++;
    }
  }
  printf("%lld\n",
         max(abs(pos[1].pasx - pos[2].pasx), abs(pos[1].pasy - pos[2].pasy)));
}
