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.*;
import java.util.*;

public class Main {
    static BufferedReader f;
    public static void main (String [] args) throws IOException {
        
        // Use BufferedReader rather than RandomAccessFile; it's much faster
        f = new BufferedReader(new java.io.InputStreamReader(System.in));
        
        long unixTime = System.currentTimeMillis();
        // 
        // Use StringTokenizer vs. readLine/split -- lots faster
        /*
         * StringTokenizer st = new StringTokenizer(f.readLine()," ");               
        int i = Integer.parseInt(st.nextToken());
        */
        
        StringTokenizer st = new StringTokenizer(f.readLine()," ");              
        int n = Integer.parseInt(st.nextToken());
        int x = Integer.parseInt(st.nextToken());
        int y = Integer.parseInt(st.nextToken());
        int c = Integer.parseInt(st.nextToken());
        
        int added=1;
        int r=1;
        int br=0,tr=0,bl=0,tl=0;
        if(c>1){
            while(true){
                r++;
                added+=(r-1)*4;
                
                boolean overRight=(x-1+r)>n;
                boolean overLeft=(x+1-r)<1;
                boolean overBottom=(y-1+r)>n;
                boolean overTop=(y+1-r)<1;
                
                boolean hbottomRight=y+(x-2+r-n)>n;
                boolean hbottomLeft=y+(1-x-2+r)>n;
                boolean htopRight=y-(x-2+r-n)<1;
                boolean htopLeft=y-(1-x-2+r)<1;
                
                boolean vbottomRight=x+(y-n-2+r)>n;
                boolean vbottomLeft=x-(y-n-2+r)<1;
                boolean vtopRight=x+(1-y-2+r)>n;
                boolean vtopLeft=x-(1-y-2+r)<1;
                
                if(overRight)added-=(x-1+r-n)*2-1;
                if(overLeft)added-=(1-x-1+r)*2-1;
                if(overTop)added-=(1-y-1+r)*2-1;
                if(overBottom)added-=(y-n-1+r)*2-1;
                
                if(hbottomRight&&vbottomRight){
                    br++;
                    added+=br;
                }
                
                if(hbottomLeft&&vbottomLeft){
                    bl++;
                    added+=bl;
                }
                
                if(htopRight&&vtopRight){
                    tr++;
                    added+=tr;
                }
                
                if(htopLeft&&vtopLeft){
                    tl++;
                    added+=tl;
                }
                
                if(added>=c){
                    break;
                }
            }
        }
        
        System.out.println(r-1);
        
//      System.out.println("Time elapsed (ms): "+(System.currentTimeMillis()-unixTime));
        
        System.exit(0);                               // don't omit this!
      }
}
class ii{
    int a;
    int b;
    public ii(int a, int b){
        this.a=a;
        this.b=b;
    }
}