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.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.math.BigInteger;
import java.util.Scanner;

public class Test {
	public static void redirectIn(String fileName){
		FileInputStream fileStream=null;
		try {
			fileStream=new FileInputStream(fileName);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		BufferedInputStream input=new BufferedInputStream(fileStream);
		System.setIn(input);
	}
	public static void redirectOut(String fileName){
		FileOutputStream fileStream=null;
		try {
			fileStream=new FileOutputStream(fileName);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		PrintStream output=new PrintStream(fileStream);
		System.setOut(output);
	}
	public static Scanner initCin(){
		//redirectIn("test.in");
		return new Scanner(new BufferedInputStream(System.in));
	}
	public static PrintStream initOut(){
		//redirectOut("test.in");
		return System.out;
	}
	public final static PrintStream out=initOut();
	public final static Scanner cin=initCin();
	
	public static BigInteger n,x,y,c;
	public static BigInteger f(BigInteger k,BigInteger m){
		BigInteger temp=k.subtract(m);
		if(k.compareTo(m)==1) return temp.multiply(temp);
		return new BigInteger("0");
	}
	public static BigInteger h(BigInteger k,BigInteger m){
		BigInteger temp=k.subtract(m);
		BigInteger one=new BigInteger("1");
		if(k.compareTo(m)==1) return temp.add(one).multiply(temp).shiftRight(1);
		return new BigInteger("0");
	}
	public static BigInteger H(BigInteger ans,BigInteger k,BigInteger x,BigInteger y) {
		BigInteger one=new BigInteger("1");
		if(k.subtract(y).compareTo(x.subtract(one))==1&&
				k.subtract(x).compareTo(y.subtract(one))==1) 
			return ans.add(h(k.subtract(y), x.subtract(one)));
		return ans;
	}
	public static BigInteger calc(BigInteger k) {
		BigInteger one=new BigInteger("1");
		BigInteger ans=k.add(one).multiply(k);
		ans=ans.add(ans).add(one);
		
		BigInteger xsubone=x.subtract(one),ysubone=y.subtract(one);
		BigInteger nsubx=n.subtract(x),nsuby=n.subtract(y);
		ans=ans.subtract(
				f(k, xsubone).add(f(k, ysubone)).add(f(k, nsubx)).add(f(k, nsuby)
						));
		//if(k-x>y-1&&k-y>x-1) and+=h(k-x,y-1);
		ans=H(ans,k,x,y);
		//if(k-(n-y+1)>x-1&&k-x>n-y) ans+=h(k-x, n-y);
		ans=H(ans, k, x, nsuby.add(one));
		//if(k-(n-x+1)>y-1&&k-y>n-x) ans+=h(k-y, n-x);
		ans=H(ans, k, y, nsubx.add(one));
		//if(k-(n-x+1)>n-y&&k-(n-y+1)>n-x) ans+=h(k-(n-y+1), n-x);
		ans=H(ans, k, nsubx.add(one), nsuby.add(one));
		return ans;
	}
	public static void main(String[] args){
		n=new BigInteger(cin.next());x=new BigInteger(cin.next());
		y=new BigInteger(cin.next());c=new BigInteger(cin.next());
		BigInteger one=new BigInteger("1");
		BigInteger l=new BigInteger("0"),r=n.multiply(n).add(one);
		while(l.compareTo(r)==-1){
			BigInteger m=l.add(r).shiftRight(1);
			if(calc(m).compareTo(c)==-1)
				l=m.add(one);
			else 
				r=m;
		}
		out.println(l);
	}
}
