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>.
#include <bits/stdc++.h>
using namespace std;
long long x, y, n, c;
long long f(long long x) { return x & 1 ? x : x / 2; }
long long count(long long h) {
  long long total, N, S, E, W, NE, NW, SE, SW;
  total = 1 + 2 * h * (h + 1);
  N = h - y;
  S = y + 1 + h - n;
  W = h - x;
  E = x + 1 + h - n;
  if (N > 0)
    N *= N;
  else
    N = 0;
  if (S > 0)
    S *= S;
  else
    S = 0;
  if (E > 0)
    E *= E;
  else
    E = 0;
  if (W > 0)
    W *= W;
  else
    W = 0;
  NW = h - (x + y + 1);
  NE = h - (n - 1 - x + y + 1);
  SW = h - (x + n - 1 - y + 1);
  SE = h - (n - 1 - x + n - 1 - y + 1);
  if (NW > 0)
    NW = f(NW) * f(NW + 1);
  else
    NW = 0;
  if (NE > 0)
    NE = f(NE) * f(NE + 1);
  else
    NE = 0;
  if (SW > 0)
    SW = f(SW) * f(SW + 1);
  else
    SW = 0;
  if (SE > 0)
    SE = f(SE) * f(SE + 1);
  else
    SE = 0;
  return total - N - S - E - W + NW + NE + SW + SE;
}
int main(void) {
  long long beg, end, h, tmp;
  cin >> n >> x >> y >> c;
  if (c == 1) {
    cout << 0 << endl;
    return 0;
  }
  x--;
  y--;
  beg = 0;
  end = (x + y);
  end = max(end, n - 1 - x + y);
  end = max(end, x + n - 1 - y);
  end = max(end, n - 1 - x + n - 1 - y);
  while (beg <= end) {
    h = (beg + end) / 2;
    tmp = count(h);
    if (tmp >= c)
      end = h - 1;
    else
      beg = h + 1;
  }
  if (count(h) < c) h++;
  cout << h << endl;
  return 0;
}
