#define _CRT_SECURE_NO_WARNINGS // #define _GLIBCXX_DEBUG #include using namespace std; template ostream &operator << (ostream &os, const vector &); template typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, const tuple &){} template typename enable_if<(n< sizeof...(T))>::type _ot(ostream &os, const tuple &t){ os << (n == 0 ? "" : " ") << get(t); _ot(os, t); } template ostream &operator << (ostream &os, const tuple &t){ _ot<0>(os, t); return os; } template ostream & operator << (ostream &os, const pair &p){ return os << "(" << p.first << ", " << p.second << ") "; } template ostream &operator << (ostream &os, const vector &v){ for(size_t i = 0; i < v.size(); i++) os << v[i] << (i + 1 == v.size() ? "" : ", "); return os; } #ifdef DEBUG #define dump(...) (cerr << #__VA_ARGS__ << " = " << make_tuple(__VA_ARGS__) \ << " (L : " << __LINE__ << ")" << endl) #else #define dump(...) #endif #define all(c) begin(c), end(c) #define range(i,a,b) for(int i = a; i < (int)(b); i++) #define rep(i,b) range(i,0,b) #define pb push_back #define eb emplace_back #define mp make_pair #define mt make_tuple typedef long long ll; // #define int ll typedef vector vi; typedef vector vvi; typedef pair pii; void fastios(){ ios_base::sync_with_stdio(0); cin.tie(0); } int const mod = 1000000007; auto const inf = numeric_limits::max()/8; template double ternarySearch(double l, double r, Function f){ for(int i = 0; i < 100; i++){ // dump(l,r); double a = (l+l+r) / 3; double b = (l+r+r) / 3; // dump(f(a), f(b)); if(f(a) > f(b)) l = a; else r = b; } return l; } int main(){ double x1,x2,y1,y2; while(cin >> x1 >> y1 >> x2 >> y2){ cout << ternarySearch(y1, y2, [&](double y){ return sqrt(x1*x1 + abs(y-y1)*abs(y-y1)) + sqrt(x2*x2 + abs(y-y2)*abs(y-y2)); }); cout << endl; } }