#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n; cin>>n;
vector<int> a, b;
for(int i = 1; i <= n; i++){
double x, y; cin>>x>>y;
a.push_back(x*10000); b.push_back(y*10000);
}
sort(a.begin(), a.end()); sort(b.begin(), b.end());
int ans = 0, x = 0, y = 0;
if(a.back() > b.back()) swap(a, b);
for(int i = 1; i <= 2*n; i++){
if(x < y && a.size() > 0){
x += a.back(); a.pop_back();
}
else{
y += b.back(); b.pop_back();
}
ans = max(ans, min(x, y) - i*10000);
}
cout<<setprecision(4)<<fixed<<(double)ans/10000;
}