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;
int n;
long long area(int x, int y, int steps);
int main() {
  int x, y, c;
  scanf("%d%d%d%d", &n, &x, &y, &c);
  int s1 = 0, s2 = max(x - 1, n - x) + max(y - 1, n - y);
  int s = 0;
  while (true) {
    if (area(x, y, s1) >= c) {
      s = s1;
      break;
    } else if (s2 - s1 <= 1) {
      s = s2;
      break;
    }
    s = (s1 + s2) / 2;
    if (area(x, y, s) < c)
      s1 = s + 1;
    else
      s2 = s;
  }
  printf("%d\n", s);
}
long long rArea(long long n) { return n * (n + 1) * 2 + 1; }
long long tArea(long long n) { return n * n; }
long long cArea(long long n) { return n * (n + 1) / 2; }
long long area(int x, int y, int steps) {
  long long area = rArea(steps);
  int sat1 = n - x, sat2 = n - y, sat3 = x - 1, sat4 = y - 1;
  int h1 = steps > sat1 ? steps - sat1 : 0;
  int h2 = steps > sat2 ? steps - sat2 : 0;
  int h3 = steps > sat3 ? steps - sat3 : 0;
  int h4 = steps > sat4 ? steps - sat4 : 0;
  area -= tArea(h1) + tArea(h2) + tArea(h3) + tArea(h4);
  if (steps > sat1 + sat2) area += cArea(steps - sat1 - sat2 - 1);
  if (steps > sat2 + sat3) area += cArea(steps - sat2 - sat3 - 1);
  if (steps > sat3 + sat4) area += cArea(steps - sat3 - sat4 - 1);
  if (steps > sat4 + sat1) area += cArea(steps - sat4 - sat1 - 1);
  return area;
}
