#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
const int maxn = 1e5 + 9;
const int mod = 1e7 + 9;
int main() {
  int a, b, x1, x2, y1, y2;
  int x, y;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  x = x1;
  y = y1;
  x1 = x + y;
  y1 = y - x;
  x = x2;
  y = y2;
  x2 = x + y;
  y2 = y - x;
  a *= 2;
  b *= 2;
  x1 = x1 / a + (x1 > 0);
  x2 = x2 / a + (x2 > 0);
  y1 = y1 / b + (y1 > 0);
  y2 = y2 / b + (y2 > 0);
  cout << max(abs(y2 - y1), abs(x2 - x1)) << endl;
  return 0;
}
