#include <bits/stdc++.h>
using namespace std;
void _print(long long t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(double t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
const long long N = 1e5 + 4;
const long long mod = 1e9 + 7;
vector<long long> adj[N];
map<pair<long long, long long>, long long> val;
vector<long long> ans;
long long dfs(long long i, long long par = -1) {
  long long cnt = 0;
  for (auto x : adj[i]) {
    if (x == par) continue;
    cnt += dfs(x, i);
  }
  if (par != -1 && cnt == 0) {
    if (val[{par, i}] == 2) {
      ans.push_back(i + 1);
      cnt += 1;
    }
  }
  return cnt;
}
long long inv(long long a, long long b) {
  if (a < 0) {
    return a / b - 1;
  } else
    return a / b;
}
void Main() {
  long long a;
  cin >> a;
  long long b;
  cin >> b;
  long long x;
  cin >> x;
  long long y;
  cin >> y;
  long long x1;
  cin >> x1;
  long long y1;
  cin >> y1;
  long long x_1 = x + y;
  long long y_1 = x - y;
  long long x_2 = x1 + y1;
  long long y_2 = x1 - y1;
  x = abs(inv(x_1, 2 * a) - inv(x_2, 2 * a));
  y = abs(inv(y_1, 2 * b) - inv(y_2, 2 * b));
  cout << max(x, y) << "\n";
}
int32_t main() {
  srand(time(0));
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    Main();
  }
}
