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
import java.io.*;
import java.util.*;

public class Solution {

	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
//		InputReader in = new InputReader("/Users/AMANRAJ/Documents/workspace/Competitive/src/input.txt");
//		OutputWriter out = new OutputWriter("/Users/AMANRAJ/Documents/workspace/Competitive/src/output.txt");
		Task task = new Task();
		int t = 1;
		for (int i = 1; i <= t; i++) task.solve(i, in, out);
		out.close();
	}

	static class Task {

		public void solve(int testNumber, InputReader in, OutputWriter out) throws IOException {
			int n = in.nextInt(), h = in.nextInt(), a = in.nextInt(), b = in.nextInt(), k = in.nextInt();
			while (k-- > 0) {
				int ta = in.nextInt(), fa = in.nextInt(), tb = in.nextInt(), fb = in.nextInt();
				if (ta == tb) out.println(Math.abs(fa - fb), "\n");
				else {
					if (fa >= a && fa <= b) out.println(Math.abs(tb - ta) + Math.abs(fb - fa), "\n");
					else if (fa <= a) out.println(Math.abs(a - fa) + Math.abs(tb - ta) + Math.abs(fb - a), "\n");
					else if (fa >= b) out.println(Math.abs(fa - b) + Math.abs(tb - ta) + Math.abs(fb - b), "\n");
				}
			}
 		}
	}
	
	static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		public InputReader(String file) throws FileNotFoundException {
			reader = new BufferedReader(new FileReader(file));
			tokenizer = null;
		}
		
		private void tokenize() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}

		public String next() {
			tokenize();
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}
		
		public char nextChar() {
			return next().charAt(0);
		}
		
		public float nextFloat() {
			return Float.parseFloat(next());
		}
		
		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int size, int a) {
			tokenize();
			int[] arr=new int[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Integer.parseInt(tokenizer.nextToken());
			}
			return arr;
		}
		
		public long[] nextLongArray(int size, int a) {
			tokenize();
			long[] arr=new long[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Long.parseLong(tokenizer.nextToken());
			}
			return arr;
		}
		
		public float[] nextFloatArray(int size, int a) {
			tokenize();
			float[] arr=new float[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Float.parseFloat(tokenizer.nextToken());
			}
			return arr;
		}

		public double[] nextDoubleArray(int size, int a) {
			tokenize();
			double[] arr=new double[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Double.parseDouble(tokenizer.nextToken());
			}
			return arr;
		}

		public String[] nextStringArray(int size, int a) throws IOException {
			String[] arr=new String[size];
			for(int i = a; i < size; i++) 
				arr[i] = reader.readLine();
			return arr;
		}

		public char[] nextCharArray() throws IOException {
			return reader.readLine().toCharArray();
		}
	}

	static class OutputWriter {
		public PrintWriter pw;

		public OutputWriter(OutputStream stream) {
			pw = new PrintWriter(stream);
		}
		
		public OutputWriter(String file) throws IOException {
			pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
		}
		
		public void println(Object... obj) {
			if (obj.length == 0) pw.println();
			else {
				String delimiter = (String) obj[obj.length - 1];
				for (int i = 0 ; i < obj.length - 1; i++) pw.print(obj[i] + delimiter);
			}
		}

		public void close() {
			pw.close();
		}

		public void flush() {
			pw.flush();
		}

		public void printStringArray(String[] arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.println(arr[i]);
			pw.println();
		}
		
		public void printBooleanArray(boolean[] arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + delimiter);
			pw.println();
		}

		public void printIntArray(int[] arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + delimiter);
			pw.println();
		}

		public void printLongArray(long[] arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + delimiter);
			pw.println();
		}

		public void printCharArray(char[] arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + delimiter);
			pw.println();
		}

		public void printFloatArray(float[] arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + delimiter);
			pw.println();
		}

		public void printDoubleArray(double[] arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + delimiter);
			pw.println();
		}
		
		public void printIntArrayList(ArrayList<Integer> arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr.get(i) + delimiter);
			pw.println();
		}
		
		public void printLongArrayList(ArrayList<Long> arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr.get(i) + delimiter);
			pw.println();
		}
		
		public void printStringArrayList(ArrayList<String> arr, int a, int b, String delimiter) {
			for(int i = a; i < b; i++)
				pw.print(arr.get(i) + delimiter);
			pw.println();
		}
	}
}
