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

public class C implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    class GraphBuilder {
        int n, m;
        int[] x, y;
        int index;
        int[] size;


        GraphBuilder(int n, int m) {
            this.n = n;
            this.m = m;
            x = new int[m];
            y = new int[m];
            size = new int[n];
        }

        void add(int u, int v) {
            x[index] = u;
            y[index] = v;
            size[u]++;
            size[v]++;
            index++;
        }

        int[][] build() {
            int[][] graph = new int[n][];
            for (int i = 0; i < n; i++) {
                graph[i] = new int[size[i]];
            }
            for (int i = m - 1; i >= 0; i--) {
                int u = x[i];
                int v = y[i];
                graph[u][--size[u]] = v;
                graph[v][--size[v]] = u;
            }
            return graph;
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new C().run();
        // new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    class Level implements Comparable<Level> {
        int a, b;
        int p;

        public Level(int a, int b, int p) {
            this.a = a;
            this.b = b;
            this.p = p;
        }

        @Override
        public int compareTo(Level o) {
            Fraction first = calc(this, o);
            Fraction second = calc(o, this);
            return first.compareTo(second);
        }
    }

    int MULTIPLIER = 10_000_000;

    Fraction calc(Level a, Level b) {
        Fraction p = new Fraction(a.p, MULTIPLIER).simplyfy();
        Fraction rp = new Fraction(MULTIPLIER - a.p, MULTIPLIER).simplyfy();
        Fraction x = new Fraction(a.a, 1);
        Fraction y = p.mul(b.b);
        Fraction z = rp.mul(b.a);
        return x.add(y).add(z);
    }

    class Fraction implements Comparable<Fraction> {

        BigInteger a, b;

        Fraction(long a, long b) {
            this.a = BigInteger.valueOf(a);
            this.b = BigInteger.valueOf(b);
        }

        public Fraction(BigInteger a, BigInteger b) {
            this.a = a;
            this.b = b;
        }

        public Fraction add(Fraction other) {
            return new Fraction(a.multiply(other.b).add(other.a.multiply(b)), b.multiply(other.b)).simplyfy();
        }

        public Fraction mul(int x) {
            BigInteger bix = BigInteger.valueOf(x);
            return new Fraction(bix.multiply(a), b).simplyfy();
        }

        private Fraction simplyfy() {
            BigInteger g = a.gcd(b);
            if (g.equals(BigInteger.ZERO)) g = BigInteger.ONE;
            return new Fraction(a.divide(g), b.divide(g));
        }

        @Override
        public int compareTo(Fraction o) {
            BigInteger x = a.multiply(o.b);
            BigInteger y = o.a.multiply(b);
            return x.compareTo(y);
        }
    }

    long count(long w, long h, long time) {
        if (w > h) return count(h, w, time);
        if (time <= w) {
            return arithm(time);
        }
        if (time >= w + h) {
            return w * h;
        }
        long base = arithm(time);
        if (time > w) {
            base -= arithm(time - w);
        }
        if (time > h) {
            base -= arithm(time - h);
        }
        return base;
    }

    long arithm(long x) {
        long y = x + 1;
        if (x % 2 == 0) x /= 2;
        else y /= 2;
        return x * y;
    }

    long count(int n, int x, int y, long time) {
        long result = count(x, y, time)
                + count(x, n - y + 1, time)
                + count(n - x + 1, y, time)
                + count(n - x + 1, n - y + 1, time);
        result -= 3;
        result -= sub(x, time) + sub(y, time) + sub(n - x + 1, time) + sub(n - y + 1, time);
        return result;
    }

    long sub(long x, long time) {
        return Math.min(time - 1, x - 1);
    }

    void solve() throws IOException {
        int n = readInt();
        int x = readInt();
        int y = readInt();
        long c = readLong();

        long l = 1;
        long r = 2 * 1000_000_000 + 100;
        long answer = 0;
        while (l <= r) {
            long mid = (l + r) >> 1;
            if (count(n, x, y, mid) >= c) {
                answer = mid;
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        out.println(answer - 1);
    }


}