#include <iostream>
#include <stdio.h>
#include <cmath>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int n;
double x[50005], r[50005];

bool check(double m)
{
	vector<pair<double, int> > vec;
	for(int i = 1; i <= n; i++){
		double l = r[i]*r[i] - m*m;
		if(l <= 0) continue;
		l = sqrt(l);
		vec.push_back(make_pair(x[i]-l, 0));
		vec.push_back(make_pair(x[i]+l, 1));
	}
	sort(vec.begin(), vec.end());
	
	double mx = 0, pre; int cnt = 0;
	for(int i = 0; i < vec.size(); i++){
		if(vec[i].second == 0){
			if(cnt == 0) pre = vec[i].first;
			cnt++;
		}
		else{
			cnt--;
			if(cnt == 0) mx = max(mx, vec[i].first - pre);
		}
	}
	return mx >= m*2;
}

int main(void)
{
	while(1){
		cin >> n;
		if(n == 0) break;
		for(int i = 1; i <= n; i++) cin >> x[i] >> r[i];
		
		double ub = 1e9, lb = 0, mid;
		for(int i = 0; i < 100; i++){
			mid = (ub+lb)/2;
			if(check(mid)) lb = mid;
			else ub = mid;
		}
		double ans = ub+lb;
		printf("%.11f\n", ans);
	}
	
	return 0;
}
