#P11271. Maximum Cup Base Radius

    ID: 13345 Type: Default 1000ms 256MiB

Maximum Cup Base Radius

Maximum Cup Base Radius

You are given a rectangular box whose bottom face lies in the Cartesian coordinate system with its vertices at \((0,0)\), \((x,0)\), \((0,y)\), and \((x,y)\). A cup is placed inside the box, but its base (a circle) is hidden from view. The only information available is that the center of the circle is located at \((p,q)\). Your task is to determine the maximum possible radius of the cup's base. The circle must be completely contained within the rectangle.

The maximum radius is determined by the minimum distance from the circle's center to any edge of the rectangle. Mathematically, it can be expressed as:

r=min(p,q,xp,yq)r = \min(p, q, x - p, y - q)

inputFormat

The input consists of a single line containing four space-separated numbers: x, y, p, and q, where x and y represent the dimensions of the rectangle, and p and q represent the coordinates of the circle's center.

outputFormat

Output a single number representing the maximum possible radius of the circle. It is guaranteed that the output will be a non-negative number.

sample

10 10 5 5
5