#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << "\n";
  err(++it, args...);
}
const int MOD = 1e9 + 7, N = 2e5 + 5, B = 32;
void solve() {
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long x, y;
  x = x1;
  y = y1;
  x1 = x + y;
  y1 = x - y;
  x = x2;
  y = y2;
  x2 = x + y;
  y2 = x - y;
  a *= 2ll;
  b *= 2ll;
  x1 = x1 / a + (x1 < 0 ? -1 : 0);
  x2 = x2 / a + (x2 < 0 ? -1 : 0);
  y1 = y1 / b + (y1 < 0 ? -1 : 0);
  y2 = y2 / b + (y2 < 0 ? -1 : 0);
  cout << max(abs(x2 - x1), abs(y2 - y1));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
}
