#include <bits/stdc++.h>
using namespace std;
int abs(int a) { return a > 0 ? a : -a; }
int main() {
  int a, b, x, y;
  cin >> a >> b >> x >> y;
  int x1 = x + y;
  int y1 = x - y;
  cin >> x >> y;
  int x2 = x + y;
  int y2 = x - y;
  x1 = x1 / (a * 2) + (x1 > 0);
  x2 = x2 / (a * 2) + (x2 > 0);
  y1 = y1 / (b * 2) + (y1 > 0);
  y2 = y2 / (b * 2) + (y2 > 0);
  cout << max(abs((int)x1 - x2), abs((int)y1 - y2)) << endl;
}
