// #include <bits/stdc++.h>
// string s;
// getline(cin, s);
// g++ -std=c++11 -O2 -Wall test.cpp -o test
// printf("%.9f\n", x); PRECISION

#include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

#define F first
#define S second

const long long MOD = 1e9 + 7;
const double EPS = 1e-9;

const int MAX_LENGTH = (2 * 1e5 + 1);
int n, c;
long long x;
long long dp[MAX_LENGTH][2];

void solve() {
    set<int> set_ids;
    unordered_map<int, long long> max_pos;
    unordered_map<int, long long> min_pos;
    int MMIN = 0, MMAX = 1;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x >> c;
        set_ids.insert(c);
        if (max_pos.find(c) == max_pos.end()) {
            max_pos[c] = x;
            min_pos[c] = x;
        } else {
            max_pos[c] = max(max_pos[c], x);
            min_pos[c] = min(min_pos[c], x);
        }
    }
    vector<int> ids(set_ids.begin(), set_ids.end());
    n = ids.size();
    dp[n - 1][MMIN] = abs(min_pos[ids[n - 1]] - max_pos[ids[n - 1]]) +
                      abs(max_pos[ids[n - 1]]);
    dp[n - 1][MMAX] = abs(min_pos[ids[n - 1]] - max_pos[ids[n - 1]]) +
                      abs(min_pos[ids[n - 1]]);

    for (int i = n - 2; i >= 0; i--) {
        int cur = ids[i];
        int next = ids[i + 1];
        long long d = abs(min_pos[cur] - max_pos[cur]);
        dp[i][MMIN] =
            d + min(dp[i + 1][MMAX] + abs(max_pos[next] - max_pos[cur]),
                    dp[i + 1][MMIN] + abs(min_pos[next] - max_pos[cur]));
        dp[i][MMAX] =
            d + min(dp[i + 1][MMAX] + abs(max_pos[next] - min_pos[cur]),
                    dp[i + 1][MMIN] + abs(min_pos[next] - min_pos[cur]));
    }
    cout << min(abs(min_pos[ids[0]]) + dp[0][MMIN],
                abs(max_pos[ids[0]]) + dp[0][MMAX]);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        // cout <<"Case #" << i << ": ";
        solve();
    }
}
#include <bits/stdc++.h>
using namespace std;
 
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 105;
int n;
pair<double,double> a[N];
pii dsu[N];

int find(int x)
{
    if(dsu[x].F == x) return x;
    return dsu[x].F = find(dsu[x].F);
}

void merge(int x,int y)
{
    int p = find(x);
    int q = find(y);
    
    if(p == q) return;
    
    if(dsu[p].S > dsu[q].S) swap(p,q);
    
    dsu[q].S+=dsu[p].S;
    dsu[p].F = dsu[q].F;
}

//n is upper
//n+1 is lower

double dis(pair<double,double> x,pair<double,double> y)
{
   return sqrt( ((x.F - y.F)*(x.F - y.F)) + ((x.S - y.S)*(x.S - y.S)) );   
}

bool check(double r)
{
    f(i,n+2) dsu[i] = {i,1};
    
    f(i,n) f(j,n)
        if(dis(a[i],a[j]) <= r + r) merge(i,j);
    
    f(i,n) if(100 - a[i].S <= r + r) merge(i,n);
    f(i,n) if(a[i].S + 100 <= r + r) merge(i,n+1); 
        
    return find(n) != find(n+1);
}

signed main()
{
    fast;
    
   cin >> n;
    
   f(i,n) cin >> a[i].F >> a[i].S;
    
   double l = 0.00000;
   double r = 100.000000;
    
   f(i,100)
   {
       double mid = (l+r)/2;
    
       if(check(mid)) l = mid;
       else r = mid;
   }
   
   cout << fixed << setprecision(4) << l;
}