#include using namespace std; #define pb push_back #define fi first #define se second #define mp make_pair #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (n); ++i) #define repp(i, a, b) for (int i = a; i <= (b); ++i) #define repr(i, a, b) for (int i = a; i >= (b); --i) #define bit(n) (1LL << (n)) #define sz(x) ((ll)(x).size()) typedef long long ll; const int INF = 1001001001; const ll LINF = 1001001001001001001ll; const int MOD = 1000000007; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } /* 上に凸な関数fに対し argmax f(x) を返す ※凸関数でないとダメ */ double EPS = 1.0e-10; double find_max(double l, double r, double f(double)) { const double Golden = 2 / (3 + sqrt(5)); double cl = l + Golden * (r - l), cr = r - Golden * (r - l); double fc = f(cl), fd = f(cr); while (cr - cl > EPS) { if (fc < fd) { l = cl; cl = cr; cr = r - Golden * (r - l); fc = fd; fd = f(cr); } else { r = cr; cr = cl; cl = l + Golden * (r - l); fd = fc; fc = f(cl); } } return cl; } double find_min(double l, double r, double f(double)) { const double Golden = 2 / (3 + sqrt(5)); double cl = l + Golden * (r - l), cr = r - Golden * (r - l); double fc = f(cl), fd = f(cr); while (cr - cl > EPS) { if (fc > fd) { l = cl; cl = cr; cr = r - Golden * (r - l); fc = fd; fd = f(cr); } else { r = cr; cr = cl; cl = l + Golden * (r - l); fd = fc; fc = f(cl); } } return (cl + cr) / 2.0; } double xa, ya; double xb, yb; double f(double y) { return sqrt(pow(xa, 2) + pow(ya - y, 2)) + sqrt(pow(xb, 2) + pow(yb - y, 2)); } int main() { cin >> xa >> ya; cin >> xb >> yb; double ans = find_min(0.0, 1000.0, f); printf("%.14f\n", ans); }