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
/*
 * For the brave souls who get this far: You are the chosen ones,
 * the valiant knights of programming who toil away, without rest,
 * fixing our most awful code. To you, true saviors, kings of men,
 * I say this: never gonna give you up, never gonna let you down,
 * never gonna run around and desert you. Never gonna make you cry,
 * never gonna say goodbye. Never gonna tell a lie and hurt you.
 * 
 * And Logic is the strongest weapon. 
 *
 */
//package Coding;

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;

public class p1 {

    private static InputStream stream;
    private static byte[] buf = new byte[1024];
    private static int curChar;
    private static int numChars;
    private static SpaceCharFilter filter;
    private static PrintWriter pw;
    //pw.print("Case #" + i + ": ");
    //private static int infi = (int) 1e9;
    //private static final int N = 1234567;
    private static final double MOD = 1e9 + 7;
    // Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

    public static int soln() {
        int n = nI(), h = nI(), a = nI(), b = nI(), k = nI();
        for (int i = 0; i < k; i++) {
            int ta = nI(), fa = nI(), tb = nI(), fb = nI();
            if (ta == tb) {
                pw.println(Math.abs(fa - fb));
                
            } else {
                if (fa < a && fb < a) {
                    pw.println(Math.abs(ta - tb) + a - fa + a - fb);
                } else if (fa > b && fb > b) {
                    pw.println(Math.abs(ta - tb) + fa - b + fb - b);
                } else {
                    pw.println(Math.abs(ta - tb) + Math.abs(fb - fa));
                }
            }

        }
        return 0;
    }

    public static void main(String[] args) throws FileNotFoundException {
        InputReader(System.in);
        //pw = new PrintWriter(new FileOutputStream("ans.txt"));
        //pw = new PrintWriter(new FileOutputStream("ans1.txt"));
        pw = new PrintWriter(System.out);
        soln();
        pw.close();
    }

    /*
     *********************************************************************************************
     */
    public static void InputReader(InputStream stream1) {
        stream = stream1;
    }

    private static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private static boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    private static int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    private static void pIArr(int[] man) {
        int l = man.length;
        for (int i = 0; i < l; i++) {
            pw.print(man[i] + " ");
        }
        pw.println();
    }

    private static void pCArr(char[] man) {
        int l = man.length;
        for (int i = 0; i < l; i++) {
            pw.print(man[i] + " ");
        }
        pw.println();
    }

    private static void pBArr(boolean[] man) {
        int l = man.length;
        for (int i = 0; i < l; i++) {
            pw.print(man[i] + " ");
        }
        pw.println();
    }

    private static void pLArr(long[] man) {
        int l = man.length;
        for (int i = 0; i < l; i++) {
            pw.print(man[i] + " ");
        }
        pw.println();
    }

    private static void pDArr(double[] man) {
        int l = man.length;
        for (int i = 0; i < l; i++) {
            pw.print(man[i] + " ");
        }
        pw.println();
    }

    private static void pFArr(float[] man) {
        int l = man.length;
        for (int i = 0; i < l; i++) {
            pw.print(man[i] + " ");
        }
        pw.println();
    }

    private static int[] nIArr(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nI();
        }
        return a;
    }

    private static long[] nLArr(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nL();
        }
        return a;
    }

    private static double[] nDArr(int n) {
        double[] a = new double[n];
        for (int i = 0; i < n; i++) {
            a[i] = nD();
        }
        return a;
    }

    private static double nD() {
        return Double.parseDouble(nS());
    }

    private static int nI() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    private static long nL() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    private static String nS() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    private static String nLi() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    private static boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }

    private interface SpaceCharFilter {

        public boolean isSpaceChar(int ch);
    }
}
