#include #include using namespace std; double min(double a, double b) { if (a > b) return b; else return a; } double max(double a, double b) { if (a < b) return b; else return a; } int main() { double ax, ay, bx, by; double p; cin >> ax >> ay; cin >> bx >> by; if (ax == bx && ay == by) { cout << ay << endl; return 0; } else if (ax == bx) { cout << (ay + by) / 2 << endl; return 0; } else if (ay == by) { cout << ay << endl; return 0; } else { double tmp = 10000000; double ans; for (p = min(ay, by); p < max(ay, by); p += 0.0000005) { if (tmp >(ay - p)*(ay - p) + (by - p)*(by - p)) { tmp = (ay - p)*(ay - p) + (by - p)*(by - p); ans = p; } } cout << ans << endl; return 0; } return 0; }