#include using namespace std; typedef long double D; D TernarySearchLowestF(D L, D R, function F, D eps = 1e-9){ D l = L, r = R; while(l < r && (r - l) > eps){ D l2 = l + (r - l) / 3, r2 = r - (r - l) / 3; if(F(r2) < F(l2)) l = l2; else r = r2; } return (l+r)/2; } int main(){ int xa,ya,xb,yb; cin >> xa >> ya >> xb >> yb; if(ya > yb){ swap(xa,xb);swap(ya,yb); } D xa2 = xa*xa, xb2 = xb*xb; auto f = [&](D yp)->D{ return sqrt(xa2 + (ya-yp)*(ya-yp)) + sqrt(xb2 + (yb-yp)*(yb-yp)); }; D res = TernarySearchLowestF(0.+ya, 0.+yb, f); cout << setprecision(12) << res << endl; }