You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.

The building consists of n towers, h floors each, where the towers are labeled from 1 to n, the floors are labeled from 1 to h. There is a passage between any two adjacent towers (two towers i and i + 1 for all i: 1 ≤ i ≤ n - 1) on every floor x, where a ≤ x ≤ b. It takes exactly one minute to walk between any two adjacent floors of a tower, as well as between any two adjacent towers, provided that there is a passage on that floor. It is not permitted to leave the building.

<image>

The picture illustrates the first example.

You have given k pairs of locations (ta, fa), (tb, fb): floor fa of tower ta and floor fb of tower tb. For each pair you need to determine the minimum walking time between these locations.

Input

The first line of the input contains following integers:

  * n: the number of towers in the building (1 ≤ n ≤ 108), 
  * h: the number of floors in each tower (1 ≤ h ≤ 108), 
  * a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), 
  * k: total number of queries (1 ≤ k ≤ 104). 



Next k lines contain description of the queries. Each description consists of four integers ta, fa, tb, fb (1 ≤ ta, tb ≤ n, 1 ≤ fa, fb ≤ h). This corresponds to a query to find the minimum travel time between fa-th floor of the ta-th tower and fb-th floor of the tb-th tower.

Output

For each query print a single integer: the minimum walking time between the locations in minutes.

Example

Input

3 6 2 3 3
1 2 1 3
1 4 3 4
1 2 2 3


Output

1
4
2
#include <bits/stdc++.h>
#pragma GCC target("popcnt")
#pragma GCC optimize("tree-vectorize")
using namespace std;
const long double EPS = 1e-10;
const long long int MOD = 1000000007ll;
const long long int mod1 = 1000000009ll;
const long long int mod2 = 1100000009ll;
int INF = (int)1e9;
long long int INFINF = (long long int)1e18;
int debug = 0;
long long int bit_count(long long int _x) {
  long long int _ret = 0;
  while (_x) {
    if (_x % 2 == 1) _ret++;
    _x /= 2;
  }
  return _ret;
}
long long int power(long long int _a, long long int _b) {
  long long int _r = 1;
  while (_b) {
    if (_b % 2 == 1) _r = (_r * _a);
    _b /= 2;
    _a = (_a * _a);
  }
  return _r;
}
long long int add(long long int a, long long int b, long long int m = MOD) {
  long long int x = (a % m + b % m) % m;
  return x;
}
long long int sub(long long int a, long long int b, long long int m = MOD) {
  long long int x = ((a % m) - (b % m) + m) % m;
  return x;
}
long long int mul(long long int a, long long int b, long long int m = MOD) {
  long long int x = ((a % m) * (b % m)) % m;
  x %= m;
  return x;
}
long long int powermod(long long int _a, long long int _b,
                       long long int _m = MOD) {
  long long int _r = 1;
  while (_b) {
    if (_b % 2 == 1) _r = (_r * _a) % _m;
    _b /= 2;
    _a = (_a * _a) % _m;
  }
  return _r % _m;
}
long long int invmod(long long int a, long long int m = MOD) {
  return powermod(a, m - 2, m);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
void printVector(vector<int> v) {
  for (int it : v) printf("%d ", it);
  printf("\n");
}
clock_t starttime;
void perr() {
  cerr << "Time taken: " << fixed << setprecision(6)
       << (double)(clock() - starttime) / (double)CLOCKS_PER_SEC
       << " seconds.\n";
}
const int N = (1e5) + 5;
const int M = (2e5) + 5;
const int LN = 20;
const int sz = 2000;
const int B = 32;
const int BB = (1e9 + sz - 1) / sz;
int dx[] = {0, 0, -1, 1, 1, -1, 1, -1};
int dy[] = {-1, 1, 0, 0, 1, -1, -1, 1};
int n, h, a, b, k, x;
string ss;
int main() {
  cin >> n >> h >> a >> b >> k;
  for (int i = 0; i < k; i++) {
    int ta, fa, tb, fb;
    cin >> ta >> fa >> tb >> fb;
    if (ta == tb) {
      cout << abs(fa - fb) << endl;
      continue;
    }
    int tmp;
    if (fa < a || fa > b) {
      tmp = (abs(fa - a) < abs(fa - b)) ? a : b;
    } else
      tmp = fa;
    int mn = (fa < a || fa > b) ? min(abs(fa - a), abs(fa - b)) : 0;
    int dis = mn + abs(tb - ta);
    dis += abs(fb - tmp);
    cout << dis << endl;
  }
  return 0;
}
