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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class TC
{
    static int x,y, c;
    static long N;
    
    static long findLen( long n )
    {
        long a2, b2, c2, d2;
        
        a2 = y-1;
        b2 = N-x;
        c2 = N-y;
        d2 = x-1;
        
        long a, b, c, d;
        
        a = Math.max( n-1-a2, 0 );
        b = Math.max( n-1-b2, 0 );
        c = Math.max( n-1-c2, 0 );
        d = Math.max( n-1-d2, 0 );
        
        long total = 2*n*n - 2*n + 1;
        
        long disappear = a*a + b*b + c*c + d*d;
        
        long[] A, B, C, D;
        
        A = new long[ 2 ];
        A[ 0 ] = x;
        A[ 1 ] = 0;
        B = new long[ 2 ];
        B[ 0 ] = N+1;
        B[ 1 ] = y;
        C = new long[ 2 ];
        C[ 0 ] = x;
        C[ 1 ] = N+1;
        D = new long[ 2 ];
        D[ 0 ] = 0;
        D[ 1 ] = y;
        
        long diffA, diffB, diffC, diffD;
        
        diffA = Math.abs( x+y- ( A[0]+A[1]));
        diffB = Math.abs( x+y- ( B[0]+B[1]));
        diffC = Math.abs( x+y- ( C[0]+C[1]));
        diffD = Math.abs( x+y- ( D[0]+D[1]));
        
        long nA, nB, nC, nD;
        
        nA = n-diffA-1;
        nB = n-diffB-1;
        nC = n-diffC-1;
        nD = n-diffD-1;
        
        long kA, kB,kC,kD;
        
        kA = Math.max(nA-b2,0);
        kB = Math.max(nB-c2,0);
        kC = Math.max(nC-d2,0);
        kD = Math.max(nD-a2,0);
        
        disappear -= kA*( kA+1 )/2;
        disappear -= kB*( kB+1 )/2;
        disappear -= kC*( kC+1 )/2;
        disappear -= kD*( kD+1 )/2;
        
        return total-disappear;
        
    }
    
    static void test()
    {
        System.out.println( findLen( 1 ));
        System.out.println( findLen( 2 ));
        System.out.println( findLen( 3 ));
        System.out.println( findLen( 4 ));
    }
    
    static long solve()
    {
        long lo = 1;
        long hi = c;
        long res = Integer.MAX_VALUE;
        
        while( lo <= hi )
        {
            long mid = ( lo + hi )/2;
            
            long cnt = findLen( mid );
                   
            if( cnt < c )
                lo = mid+1;
            
            else
            {
                hi = mid-1;
                res = Math.min( res, mid );
            }
        }
        
        return res;
    }
    
    public static void main( String[] args ) throws IOException
    {
        
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ));
        BufferedWriter out = new BufferedWriter( new OutputStreamWriter( System.out ));
        String s = br.readLine();
        StringTokenizer tok = new StringTokenizer( s );
        
        N = Integer.parseInt( tok.nextToken() );
        y = Integer.parseInt( tok.nextToken() );
        x = Integer.parseInt( tok.nextToken() );
        c = Integer.parseInt( tok.nextToken() );
        
        //test();
        out.write( Long.toString( solve()-1 ) + "\n" );
        out.close();
    }
}