#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
using namespace std;
template <class T1, class T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <class T1, class T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& p) {
  out << p.first << ' ' << p.second << '\n';
  return out;
}
template <class T>
istream& operator>>(istream& in, vector<T>& arr) {
  for (T& i : arr) in >> i;
  return in;
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& arr) {
  for (const T& i : arr) out << i << ' ';
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const vector<vector<T>>& arr) {
  for (const vector<T>& i : arr) out << i << ' ' << '\n';
  return out;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b, x1, y1, x2, y2;
  cin >> a >> b >> x1 >> y1 >> x2 >> y2;
  long long yel1 = (x1 - y1) / (2 * b);
  if (x1 - y1 < 0) yel1--;
  long long yel2 = (x2 - y2) / (2 * b);
  if (x2 - y2 < 0) yel2--;
  long long bl1 = (x1 + y1) / (2 * a);
  if (x1 + y1 < 0) bl1--;
  long long bl2 = (x2 + y2) / (2 * a);
  if (x2 + y2 < 0) bl2--;
  long long ym = abs(yel1 - yel2);
  long long bm = abs(bl1 - bl2);
  cout << max(ym, bm) << '\n';
  return 0;
}
