#include <bits/stdc++.h>
using namespace std;
struct pt {
  long long x, y;
};
pt p1, p2, s, f;
long long a, b;
int main() {
  cin >> a >> b >> p1.x >> p1.y >> p2.x >> p2.y;
  s.x = p1.x + p1.y;
  s.y = p1.y - p1.x;
  f.x = p2.x + p2.y;
  f.y = p2.y - p2.x;
  s.x += 2 * a * 1000000000;
  s.y += 2 * b * 1000000000;
  f.x += 2 * a * 1000000000;
  f.y += 2 * b * 1000000000;
  f.x /= 2 * a;
  s.x /= 2 * a;
  f.y /= 2 * b;
  s.y /= 2 * b;
  cout << max(abs(f.x - s.x), abs(f.y - s.y));
  return 0;
}
