Mr. Bender has a digital table of size n × n, each cell can be switched on or off. He wants the field to have at least c switched on squares. When this condition is fulfilled, Mr Bender will be happy.

We'll consider the table rows numbered from top to bottom from 1 to n, and the columns — numbered from left to right from 1 to n. Initially there is exactly one switched on cell with coordinates (x, y) (x is the row number, y is the column number), and all other cells are switched off. Then each second we switch on the cells that are off but have the side-adjacent cells that are on.

For a cell with coordinates (x, y) the side-adjacent cells are cells with coordinates (x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1).

In how many seconds will Mr. Bender get happy?

Input

The first line contains four space-separated integers n, x, y, c (1 ≤ n, c ≤ 109; 1 ≤ x, y ≤ n; c ≤ n2).

Output

In a single line print a single integer — the answer to the problem.

Examples

Input

6 4 3 1


Output

0


Input

9 3 8 10


Output

2

Note

Initially the first test has one painted cell, so the answer is 0. In the second test all events will go as is shown on the figure. <image>.
import java.util.*;
import java.io.*;

public class D {
	FastScanner in;
	PrintWriter out;

	long calcArea(long x, long y, long n, long time) {
		long res;
		long longN = time;
		res = 2 * time * (time + 1) + 1;
		boolean top = false, botom = false, left = false, right = false;
		if (x + time > n) {
			right = true;
			res -= (x + time - n) * (x + time - n);
		}
		if (x - time <= 0) {
			left = true;
			res -= (x - time - 1) * (x - time - 1);
		}
		if (y + time > n) {
			top = true;
			res -= (y + time - n) * (y + time - n);
		}
		if (y - time <= 0) {
			botom = true;
			res -= (y - time - 1) * (y - time - 1);
		}
		if (top && left) {
			long col = time - 1;
			col -= n - y;
			col -= x - 1;
//			System.err.println(col);
			if (col > 0) {
				res += ((col + 1) * col) / 2;
			}
		}
		if (top && right) {
			long col = time - 1;
			col -= n - y;
			col -= n - x;
//			System.err.println(col);
			if (col > 0) {
				res += ((col + 1) * col) / 2;
			}
		} if (botom && left) {
			long col = time - 1;
			col -= y - 1;
			col -= x - 1;
//			System.err.println(col);
			if (col > 0) {
				res += ((col + 1) * col) / 2;
			}
		} if (botom && right) {
			long col = time - 1;
			col -= y - 1;
			col -= n - x;
//			System.err.println(col);
			if (col > 0) {
				res += ((col + 1) * col) / 2;
			}
		}
		return res;
	}

	long binSearch(long x, long y, long n, long c) {
		long  l = -1;
		long r = 100000000;
		while (l < r - 1) {
			long m = (l + r) >> 1;

//			System.err.println(l + " " + r + " " + m + " "
//					+ calcArea(x, y, n, m));
			if (calcArea(x, y, n, m) < c) {
				l = m;
			} else {
				r = m;
			}
//			System.err.println(l + " " + r + " " + m + " "
//					+ calcArea(x, y, n, m));
		}
		return r;
	}

	public void solve() throws IOException {
		long n = in.nextInt(), x = in.nextInt(), y = in.nextInt();
		long c = in.nextLong();
		out.println(binSearch(x, y, n, c));
//		out.println(calcArea(1, 1, 4, 10000));
	}

	public void run() {
		try {
			in = new FastScanner(System.in);
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws IOException {
			return hasNext() ? st.nextToken() : null;
		}

		boolean hasNext() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				String line = br.readLine();
				if (line == null) {
					return false;
				}
				st = new StringTokenizer(line);
			}
			return true;
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
	}

	public static void main(String[] arg) {
		new D().run();
	}
}