#include <bits/stdc++.h>
using namespace std;
int A, B, Px, Py, Qx, Qy;
void process() {
  int t1, t2, t3, t4;
  t1 = (Px + Py) / (A * 2);
  if (Px + Py < 0) t1--;
  t2 = (Qx + Qy) / (A * 2);
  if (Qx + Qy < 0) t2--;
  t3 = (Px - Py) / (B * 2);
  if (Px - Py < 0) t3--;
  t4 = (Qx - Qy) / (B * 2);
  if (Qx - Qy < 0) t4--;
  cout << max(abs(t1 - t2), abs(t3 - t4));
}
int main() {
  scanf("%d%d%d%d%d%d", &A, &B, &Px, &Py, &Qx, &Qy);
  process();
  return 0;
}
