#include <bits/stdc++.h>
using namespace std;
long long int roundup(long long int x, long long int a) {
  return (x < 0 ? x - x % a : x + 4 - x % a);
}
long long int rounddown(long long int x, long long int a) {
  return (x < 0 ? x - 4 - x % a : x - x % a);
}
int main() {
  long long int a, b, x1, y1, x2, y2, yy1, yy2, res1 = 0, res2 = 0;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  a *= 2;
  b *= 2;
  yy1 = y1 + x1;
  yy2 = y2 + x2;
  if (yy1 > yy2) swap(yy1, yy2);
  yy1 = roundup(yy1, a);
  yy2 = rounddown(yy2, a);
  if (yy1 <= yy2) res1 = (yy2 - yy1) / a + 1;
  yy1 = y1 - x1;
  yy2 = y2 - x2;
  if (yy1 > yy2) swap(yy1, yy2);
  yy1 = roundup(yy1, b);
  yy2 = rounddown(yy2, b);
  if (yy1 <= yy2) res2 = (yy2 - yy1) / b + 1;
  cout << max(res1, res2) << endl;
  return 0;
}
