#include <bits/stdc++.h>
bool DEBUG = false;
using namespace std;
int a, b;
pair<int, int> get_coords(pair<int, int> p) {
  pair<int, int> result;
  result.first = (p.first + p.second) / (2 * a);
  if (p.first + p.second < 0) result.first--;
  result.second = (p.second - p.first) / (2 * b);
  if (p.second - p.first < 0) result.second--;
  return result;
}
int main() {
  pair<int, int> p1, p2;
  cin >> a >> b >> p1.first >> p1.second >> p2.first >> p2.second;
  if (DEBUG) {
    cout << "p1"
         << ": (" << (p1).first << ";" << (p1).second << ")" << endl;
  };
  if (DEBUG) {
    cout << "p2"
         << ": (" << (p2).first << ";" << (p2).second << ")" << endl;
  };
  p1 = get_coords(p1);
  p2 = get_coords(p2);
  if (DEBUG) {
    cout << "p1"
         << ": (" << (p1).first << ";" << (p1).second << ")" << endl;
  };
  if (DEBUG) {
    cout << "p2"
         << ": (" << (p2).first << ";" << (p2).second << ")" << endl;
  };
  p1.first -= p2.first;
  p1.second -= p2.second;
  if (DEBUG) {
    cout << "p1"
         << ": (" << (p1).first << ";" << (p1).second << ")" << endl;
  };
  p1.first = ((p1.first) < 0 ? (-(p1.first)) : (p1.first));
  p1.second = ((p1.second) < 0 ? (-(p1.second)) : (p1.second));
  if (DEBUG) {
    cout << "p1"
         << ": (" << (p1).first << ";" << (p1).second << ")" << endl;
  };
  cout << ((p1.first) > (p1.second) ? (p1.first) : (p1.second));
  return 0;
}
