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.*;
import java.io.*;
public class Solution implements Runnable {
    FastScanner sc;
    PrintWriter pw;
    
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
 
        public long nlo() {
            return Long.parseLong(next());
        }
 
        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }
 
        public int ni() {
            return Integer.parseInt(next());
        }
 
        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }
 
        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public static void main(String[] args) throws Exception
    {
        new Thread(null,new Solution(),"codeforces",1<<28).start();
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
        try{
        solve();}
        catch(Exception e)
        {
            pw.println(e);
        }
        pw.flush();
        pw.close();
    }
    public long gcd(long a,long b)
    {
        return b==0L?a:gcd(b,a%b);
    }
    public long ppow(long a,long b,long mod)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            a%=mod;
            tmp%=mod;
            b>>=1;
        }
        return (tmp*a)%mod;
    }
    public long pow(long a,long b)
    {
        if(b==0L)
        return 1L;
        long tmp=1;
        while(b>1L)
        {
            if((b&1L)==1)
            tmp*=a;
            a*=a;
            b>>=1;
        }
        return (tmp*a);
    }
    public  int gcd(int x,int y)
    {
        return y==0?x:gcd(y,x%y);
    }
   
    //////////////////////////////////
    /////////////  LOGIC  ///////////
    ////////////////////////////////
    
    public void solve() throws Exception{
        long n=sc.nlo();
        long x=sc.nlo();
        long y=sc.nlo();
        long c=sc.nlo();
        long l=1,r=2L*n+1L,ans=1;
        while(l<=r){
            long m=(l+r)/2L;
            //pw.println(m+" "+f(x,y,n,m));
            if(f(x,y,n,m)>=c){
                ans=m;
                r=m-1L;
            }
            else
            l=m+1L;
        }
        ans-=1L;
        pw.println(ans);
   }
   public long f(long x,long y,long n,long t){
       if(t<=1)
       return 1;
       long ans=0;
       long b=Math.abs(x-1);
       long l=Math.abs(n-y);
       ans+=g(l,b,t-2);

       l=Math.abs(1-y);
       b=Math.abs(1-x);
       ans+=g(l,b,t-2);
       
       l=Math.abs(1-y);
       b=Math.abs(n-x);
       ans+=g(l,b,t-2);

       l=Math.abs(n-y);
       b=Math.abs(n-x);
       ans+=g(l,b,t-2);

       l=Math.min(t,n-y+1);
       b=Math.min(t,x);
       ans+=(l+b);
       
       l=Math.min(t,y);
       b=Math.min(t,n-x+1);
       ans+=(l+b);
       ans-=3;
       return ans;
   }
   public long g(long l,long b,long t){
       b=Math.min(b,t);
       long ans=0;
       ans=(b*(2L*t-(b-1L)))/2L;
       t=Math.max(0,t-l);
       b=Math.min(b,t);
       ans-=(b*(2L*t-(b-1L)))/2L;
       return ans;
   }
}