var x,y,z,d:real;
function min(a:real; b:real) : real;
begin
if(a > b) then min:=b
else min:=a;
end;
function max(a:real; b:real; c:real) : real;
begin
if((a >= b) and (a >= c)) then max:=a;
if((b >= a) and (b >= c)) then max:=b;
if((c >= a) and (c >= b)) then max:=c;
end;
begin
read(x,y,z,d);
write(max (min (x, y), min (x, z), min (z, d))) ;
end.