#include <bits/stdc++.h>
char g[64][64];
int h[64][64];
void conv(long long x, long long y, long long a, long long b, long long *dx,
          long long *dy) {
  long long k, l;
  k = x - y + b * 2000000000LL;
  l = x + y + a * 2000000000LL;
  *dx = k / (2 * b) - 1000000000LL;
  *dy = l / (2 * a) - 1000000000LL;
}
void solve(int x1, int y1, int x2, int y2, int a, int b) {
  long long c, d, e, f, g, h, i;
  conv(x1, y1, a, b, &c, &d);
  conv(x2, y2, a, b, &e, &f);
  g = c - e;
  if (g < 0) g = -g;
  h = d - f;
  if (h < 0) h = -h;
  i = g > h ? g : h;
  printf("%d\n", i);
}
int main() {
  int i, j, u, v;
  int a, b, x1, y1, x2, y2;
  long long A, B;
  long long k, l;
  memset(g, 0, sizeof(g));
  scanf("%d %d %d %d %d %d", &a, &b, &x1, &y1, &x2, &y2);
  solve(x1, y1, x2, y2, a, b);
  return 0;
}
