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.*;

public class Square {
	public static void main(String[] args) {
		Scanner sc = new  Scanner(System.in);
		n = sc.nextInt();
		x = sc.nextInt()-1;
		y = sc.nextInt()-1;
		c = sc.nextLong();
	//	simulate(198);
		long t = 1;
		for(int i=0; i<18; i++) t *= 10;
		long ans = binary(0, t);
		System.out.println(ans);
	//	System.out.println(countAfter(198));
	//	System.out.println(countAfter(0)+" "+countAfter(1)+" "+countAfter(2));
		// 10 7 2 7 (real ans = 2).
	}
	// 549 198 8 262611  real: 635
	
	//static long realCount()
	
	static long binary(long L, long R){
		if(L==R) return R;
		if(R==L+1) return countAfter(L)>=c? L: R;
		long M = (L+R)>>1;
		return countAfter(M)>=c? binary(L, M): binary(M+1, R);
	}
	
	static long countAfter(long steps){
		long ans = 0;
		ans = numberIn(x, n-y-1, steps) + numberIn(x, y, steps) + numberIn(n-x-1, y, steps) + numberIn(n-x-1, n-y-1, steps);
	//	System.out.println(numberIn(x, n-y-1, steps)+" "+numberIn(x, y, steps)+" "+numberIn(n-x-1, y, steps)+" "+
	//			numberIn(n-x-1, n-y-1, steps) );
		long lx = Math.max(0, x-steps), ly = Math.min(x+steps, n-1);
		long numOnLine = ly-lx+1;
		lx = Math.max(0, y-steps); ly = Math.min(y+steps, n-1);
		numOnLine += ly-lx+1;
		return ans-numOnLine-1;
	}
	
	
	static void simulate(int num){
		int[][] a = new int[n][n];
		a[x][y] = 1;
		for(int i=0; i<num; i++){
			change(a);
	/**		long cnt = countAfter(i+1);
			int tot = 0;
			for(int z=0; z<n; z++) for(int j=0; j<n; j++) if(a[z][j]!=0) tot++;
			if(tot!=cnt){
				System.out.println(i+1+" asgaw");
				System.exit(0);
			}*/
		}
		int tot = 0;
		for(int i=0; i<n; i++) for(int j=0; j<n; j++) if(a[i][j]!=0) tot++;
		System.out.println("Total is: "+tot);
	}
	
	static void change(int[][] a){
		int[][] b = new int[n][n];
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				for(int d=0; d<4; d++){
					int X = dx[d], Y = dy[d];
					if(in(i+X, j+Y) && a[i+X][j+Y]!=0) b[i][j] = 1;
				}
				if(a[i][j]!=0) b[i][j] = 1;
				
			}
		}
		for(int i=0; i<n; i++) for(int j=0; j<n; j++) a[i][j] = b[i][j];
	}
	
	static boolean in(int p, int q){
		return p>=0 && q>=0 && p<n && q<n;
	}
	
	static int[] dx = new int[]{-1, 1, 0, 0}, dy = new int[]{0, 0, -1, 1};
	
	static long numberIn(long a, long b, long steps){
	//	System.out.println("count "+a+" "+b+" in steps = "+steps);
		if(b>a) return numberIn(b, a, steps);
		long res = (steps+1)*(steps+2)/2;
		if(steps<=b){
	//		System.out.println(res);
			return res;
		}
		if(steps<=a){
	//		System.out.println((b+1)*(b+2)/2 + (b+1)*(steps-b));
			return (b+1)*(b+2)/2 + (b+1)*(steps-b);
		}
		if(steps<=a+b){
	//		System.out.print("aexla mogetynat ... ");
	//		System.out.println((b+1)*(b+2)/2 + (b+1)*(a-b)+sum(a+b-steps+1, b)+" "+sum(a+b-steps+1, b));
			return (b+1)*(b+2)/2 + (b+1)*(a-b)+sum(a+b-steps+1, b);
		}
	//	System.out.println((a+1)*(b+1));
		return (a+1)*(b+1);
	}
	
	static long till(long x){
		return x*(x+1)/2;
	}
	
	static long sum(long low, long high){
		return till(high)-(low>0? till(low-1): 0);
	}
	
	
	static int n, x, y;
	
	static long c;
	
}
