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
// AUTHOR : MAYANK SUNAL

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

public class Main {
	static final Random random = new Random();
	static PrintWriter out = new PrintWriter((System.out));
	static Reader sc = new Reader();

	public static void main(String args[]) throws IOException {
//		int t = sc.nextInt();
//		while (t-- > 0) {
//        	CODE START FROM HERE long n = sc.nextLong();

		int n = sc.nextInt();
		int h = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		while (k-- > 0) {
			int ta = sc.nextInt();
			int fa = sc.nextInt();
			int tb = sc.nextInt();
			int fb = sc.nextInt();
			if (ta == tb)
				System.out.println(Math.abs(fa - fb));
			else {
				int res = 0;
				int fm = 0;
				int path = fa;
				if (fa > b) {
					fm = fa - b;
					path = b;
				}
				if (fa < a) {
					fm = a - fa;
					path = a;
				}
				res = fm + Math.abs(tb - ta) + Math.abs(fb - path);
				System.out.println(res);
			}
		}

	}

// 		}
// }
// Fast Input Output
	static class Reader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			try {
				return br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return null;
		}

		public boolean hasNext() {
			String next = null;
			try {
				next = br.readLine();
			} catch (Exception e) {
			}
			if (next == null) {
				return false;
			}
			st = new StringTokenizer(next);
			return true;
		}

	}

	// EFFICIENT SORTING Ascending
	static void ruffleSortAsc(Integer[] a) {
		int n = a.length; // shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a);
	}

//	EFFICIENT SORTING Descending
	static void ruffleSortDesc(Integer[] a) {
		int n = a.length; // shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a, Collections.reverseOrder());
	}

	// Array Sum
	static long sum(Integer[] arr) {
		long sum = 0;
		for (int i : arr)
			sum += i;
		return sum;
	}

	// ArrayList Sum
	static long sumal(ArrayList<Integer> al) {
		long sum = 0;
		for (int i : al)
			sum += i;
		return sum;
	}

	// swap array elements
	static void swap(int arr1[], int arr2[], int i, int j) {
		int temp = arr1[i];
		arr1[i] = arr2[j];
		arr2[j] = temp;
	}

	// reading array value;
	static void read(Integer[] arr) {
		for (int i = 0; i < arr.length; i++)
			arr[i] = sc.nextInt();
		return;
	}

//    reading arraylistValue

	static void readal(List<Integer> l, int n) {
		for (int i = 0; i < n; i++)
			l.add(sc.nextInt());
		return;
	}

	// check for even odd
	static boolean isEven(long n) {
		return ((n & 1) != 1);
	}

	// max in a array
	static int max(Integer[] arr) {
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < arr.length; i++)
			if (max < arr[i])
				max = arr[i];
		return max;
	}

//  print array
	static void printarr(Integer arr[]) {
		for (int i : arr)
			System.out.println(i);
	}

// ceil of two elements
	static int ceil(int a, int b) {
		return (int) Math.ceil(((double) a / (double) b));
	}

// floor of two elements
	static int floor(int a, int b) {
		return (int) Math.floor(((double) a / (double) b));
	}
}