#include <bits/stdc++.h>
using namespace std;
long long ans, x1, y3, x2, y2, a, b;
int cal(int a, int b) { return (int)floor((double)a / b); }
int main() {
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d", &a, &b, &x1, &y3, &x2, &y2);
  a = a * 2;
  b = b * 2;
  ans = max(abs(cal(x1 + y3, a) - cal(x2 + y2, a)),
            abs(cal(x1 - y3, b) - cal(x2 - y2, b)));
  printf("%I64d", ans);
  return 0;
}
