#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
constexpr int INF = 1e9, MOD = 1e9 + 7;
constexpr int64_t LINF = 5e18, LMOD = 998244353;
// #include <atcoder/all>
// using namespace atcoder;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int64_t dp[200010][2];
map<int, set<int>> mp;
int main() {
	rep(i,200010)rep(j,2) dp[i][j] = LINF;
	dp[0][0] = dp[0][1] = 0;
	int n; cin >> n;
	rep(i,n) {
		int x, c; cin >> x >> c;
		mp[c].insert(x);
	}
	mp[n + 1].insert(0);
	int preL = 0, preR = 0;
	int pre_idx = 0;
	for(auto [idx, st] : mp) {
		int L = *st.begin();
		int R = *prev(st.end());
		if(L == R) {
			dp[idx][0] = dp[idx][1] = min(dp[pre_idx][0] + abs(preL - L), dp[pre_idx][1] + abs(preR - R)); 
		} else {
			dp[idx][0] = min(dp[pre_idx][0] + abs(preL - R) + abs(R - L), dp[pre_idx][1] + abs(preR - R) + abs(R - L));
			dp[idx][1] = min(dp[pre_idx][0] + abs(preL - L) + abs(R - L), dp[pre_idx][1] + abs(preR - L) + abs(R - L));
		}
		preL = L;
		preR = R;
		pre_idx = idx;
	}
	cout << dp[n + 1][0] << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int a,b,c;
double f[105][105][105],ans;
int main() {
	cin>>a>>b>>c;
	f[a][b][c]=1;
	for(int i=0; i<100; i++) {
		for(int j=0; j<100; j++) {
			for(int k=0; k<100; k++) {
				if (i && (i + j + k) > 0)
					f[i + 1][j][k] += f[i][j][k] * (i) / (i + j + k);
				if (j && (i + j + k) > 0)
					f[i][j + 1][k] += f[i][j][k] * (j) / (i + j + k);
				if (k && (i + j + k) > 0)
					f[i][j][k + 1] += f[i][j][k] * (k) / (i + j + k);
			}
		}
	}
	for(int i=0;i<=100;i++){
		for(int j=0;j<=100;j++){
			if(i>=b&&j>=c) ans+=(double)((i-b)+(100-a)+(j-c))*f[100][i][j];
			if(i>=a&&j>=c) ans+=(double)((i-a)+(100-b)+(j-c))*f[i][100][j];
			if(i>=a&&j>=b) ans+=(double)((i-a)+(j-b)+(100-c))*f[i][j][100];
		}
	}
	printf("%.9lf",ans);
	return 0;
}