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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class MrBenderAndSquare {
	long size(long t) {
		return ((2 * t + 1) * (2 * t + 1) / 2) + 1;
	}

	long areaTop(int n, int x, int y, long t) {
		int dist = y - 1;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist);
	}

	long areaBot(int n, int x, int y, long t) {
		int dist = n - y;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist);
	}

	long areaRight(int n, int x, int y, long t) {
		int dist = n - x;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist);
	}

	long areaLeft(int n, int x, int y, long t) {
		int dist = x - 1;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist);
	}

	long areaTopRight(int n, int x, int y, long t) {
		long dist = n - x + y;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist + 1) / 2;
	}

	long areaTopLeft(int n, int x, int y, long t) {
		long dist = x - 1 + y;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist + 1) / 2;
	}

	long areaBotRight(int n, int x, int y, long t) {
		long dist = n - x + n - y + 1;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist + 1) / 2;
	}

	long areaBotLeft(int n, int x, int y, long t) {
		long dist = n - y + x;
		if (t <= dist)
			return 0;

		return (t - dist) * (t - dist + 1) / 2;
	}

	long areaNegativa(int n, int x, int y, long t) {
		return areaTop(n, x, y, t) + areaBot(n, x, y, t) + areaLeft(n, x, y, t) + areaRight(n, x, y, t) - areaTopRight(n, x, y, t) - areaTopLeft(n, x, y, t)
				- areaBotRight(n, x, y, t) - areaBotLeft(n, x, y, t);
	}

	long area(int n, int x, int y, long t) {
		return size(t) - areaNegativa(n, x, y, t);
	}

	long binSearch(int n, int x, int y, int c) {
		long t1 = 1;
		long t2 = 1 << 30;
		long mean, area;

		while (t1 < t2) {
			mean = (t1 + t2) / 2;
			area = area(n, x, y, mean);
			//System.out.println("t1=" + t1 + " t2=" + t2 + " mean=" + mean + " area=" + area);
			// if (area == c) return mean;
			if (area < c)
				t1 = mean + 1;
			else
				t2 = mean;
		}

		return t1;
	}

	public static void main(String[] args) throws IOException {
		new MrBenderAndSquare();
	}
	
	public MrBenderAndSquare(int n, int x, int y, long t) {
		printArea(n, x, y, t);
	}

	public MrBenderAndSquare() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] split = br.readLine().split(" ");
		int n = Integer.parseInt(split[0]);
		int x = Integer.parseInt(split[1]);
		int y = Integer.parseInt(split[2]);
		int c = Integer.parseInt(split[3]);

		long resp = 0;
		if (c > 1)
			resp = binSearch(n, x, y, c);

		System.out.println(resp);
	}
	
	void printArea(int n, int x, int y, long t) {
		System.out.println("areaBot = "+areaBot(n, x, y, t));
		System.out.println("areaTop = "+areaTop(n, x, y, t));
		System.out.println("areaLeft = "+areaLeft(n, x, y, t));
		System.out.println("areaRight = "+areaRight(n, x, y, t));
		System.out.println("areaTopLeft = "+areaTopLeft(n, x, y, t));
		System.out.println("areaTopRight = "+areaTopRight(n, x, y, t));
		System.out.println("areaBotLeft = "+areaBotLeft(n, x, y, t));
		System.out.println("areaBotRight = "+areaBotRight(n, x, y, t));
		System.out.println("size = "+size(t));
		System.out.println("area = "+area(n, x, y, t));
	}
}
