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.awt.Point;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.StringTokenizer;

public class Solver {

	public static void main(String[] Args) throws NumberFormatException,
			IOException {
		new Solver().Run();
	}

	PrintWriter pw;
	StringTokenizer Stok;
	BufferedReader br;

	public String nextToken() throws IOException {
		while (Stok == null || !Stok.hasMoreTokens()) {
			Stok = new StringTokenizer(br.readLine());
		}
		return Stok.nextToken();
	}

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

	public double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

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

	int n;
	Point start;
	long kolGoal;
	List<ChangeEvent> events=new ArrayList<Solver.ChangeEvent>();
	
	class State{
		
		public long x;
		public long dx;
		
		public State(long ax, long adx){
			x=ax;
			dx=adx;
		}
	}
	
	class ChangeEvent implements Comparable<ChangeEvent>{

		public long numStep;
		public int changeDx;
		
		public ChangeEvent(long anumStep, int achangeDx){
			numStep=anumStep;
			changeDx=achangeDx;
		}
		
		@Override
		public int compareTo(ChangeEvent o) {
			long zn=numStep-o.numStep;
			if (zn>0)
				return 1;
			
			if (zn==0)
				return 0;
			
			return -1;
		}
		
	}
	
	long findStep(Point fin){
		return Math.abs(start.x-fin.x)+Math.abs(start.y-fin.y);
	}
	
	void addEvents(){
		events.add(new ChangeEvent(findStep(new Point(start.x, n)), -1));
		events.add(new ChangeEvent(findStep(new Point(start.x, n+1)), -1));
		events.add(new ChangeEvent(findStep(new Point(start.x, 1)), -1));
		events.add(new ChangeEvent(findStep(new Point(start.x, 0)), -1));
		events.add(new ChangeEvent(findStep(new Point(n, start.y)), -1));
		events.add(new ChangeEvent(findStep(new Point(n+1, start.y)), -1));
		events.add(new ChangeEvent(findStep(new Point(1, start.y)), -1));
		events.add(new ChangeEvent(findStep(new Point(0, start.y)), -1));
		events.add(new ChangeEvent(findStep(new Point(1,0)), 1));
		events.add(new ChangeEvent(findStep(new Point(n,0)), 1));
		events.add(new ChangeEvent(findStep(new Point(0,n)), 1));
		events.add(new ChangeEvent(findStep(new Point(n+1,n)), 1));
		Collections.sort(events);
	}
	
	State findState(State curState, long ddx, long curStep, long lastStep){
		long startDx=curState.dx+ddx;
		long kolSteps=lastStep-curStep+1;
		long finDx=curState.dx+ddx*kolSteps;
		long addSum=kolSteps*(startDx+finDx)/2;
		return new State(curState.x+addSum, finDx);
	}
	
	public void Run() throws NumberFormatException, IOException {
		//br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter("output.txt");
		br=new BufferedReader(new InputStreamReader(System.in));  pw=new PrintWriter(new OutputStreamWriter(System.out));
		n=nextInt();
		start=new Point(nextInt(),nextInt());
		kolGoal=nextLong();
		addEvents();
		long curStep=1;
		State curState=new State(1, 0);
		if (curState.x>=kolGoal){
			pw.println(0);
			pw.flush();
			pw.close();
			return;
		}
		long ddx=4; //вторая производная
		boolean inSegment=false;
		State nextState;
		int curEventInd=0;
		while (!inSegment){
			nextState=findState(curState,ddx,curStep,events.get(curEventInd).numStep);
			if (nextState.x>=kolGoal){
				inSegment=true;
			}
			else{
				curState=nextState;
				curStep=events.get(curEventInd).numStep+1;
				while (events.get(curEventInd).numStep+1==curStep){
					ddx+=events.get(curEventInd).changeDx;
					curEventInd++;
				}
			}
		}
		
		//метод половинного деления
		long min=curStep-1; //недостижимое значение
		long max=events.get(curEventInd).numStep; // - достижимое значение
		long mid;
		while (max-min>1){
			mid=(max+min)/2;
			nextState=findState(curState, ddx, curStep, mid);
			if (nextState.x>=kolGoal){
				max=mid;
			}
			else
				min=mid;
		}
		pw.println(max);
		pw.flush();
		pw.close();
	}

}
