Problem: Problem Statement

Circles Island is known for its mysterious shape: it is a completely flat island with its shape being a union of circles whose centers are on the $x$-axis and their inside regions.

The King of Circles Island plans to build a large square on Circles Island in order to celebrate the fiftieth anniversary of his accession. The King wants to make the square as large as possible. The whole area of the square must be on the surface of Circles Island, but any area of Circles Island can be used for the square. He also requires that the shape of the square is square (of course!) and at least one side of the square is parallel to the $x$-axis.

You, a minister of Circles Island, are now ordered to build the square. First, the King wants to know how large the square can be. You are given the positions and radii of the circles that constitute Circles Island. Answer the side length of the largest possible square.

$N$ circles are given in an ascending order of their centers' $x$-coordinates. You can assume that for all $i$ ($1 \le i \le N-1$), the $i$-th and $(i+1)$-st circles overlap each other. You can also assume that no circles are completely overlapped by other circles.

<image>

[fig.1 : Shape of Circles Island and one of the largest possible squares for test case #1 of sample input]

Input

The input consists of multiple datasets. The number of datasets does not exceed $30$. Each dataset is formatted as follows.

> $N$
> $X_1$ $R_1$
> :
> :
> $X_N$ $R_N$

The first line of a dataset contains a single integer $N$ ($1 \le N \le 50{,}000$), the number of circles that constitute Circles Island. Each of the following $N$ lines describes a circle. The $(i+1)$-st line contains two integers $X_i$ ($-100{,}000 \le X_i \le 100{,}000$) and $R_i$ ($1 \le R_i \le 100{,}000$). $X_i$ denotes the $x$-coordinate of the center of the $i$-th circle and $R_i$ denotes the radius of the $i$-th circle. The $y$-coordinate of every circle is $0$, that is, the center of the $i$-th circle is at ($X_i$, $0$).

You can assume the followings.

* For all $i$ ($1 \le i \le N-1$), $X_i$ is strictly less than $X_{i+1}$.
* For all $i$ ($1 \le i \le N-1$), the $i$-th circle and the $(i+1)$-st circle have at least one common point ($X_{i+1} - X_i \le R_i + R_{i+1}$).
* Every circle has at least one point that is not inside or on the boundary of any other circles.



The end of the input is indicated by a line containing a zero.

Output

For each dataset, output a line containing the side length of the square with the largest area. The output must have an absolute or relative error at most $10^{-4}$.

Sample Input


2
0 8
10 8
2
0 7
10 7
0

Output for the Sample Input


12.489995996796796
9.899494936611665





Example

Input

2
0 8
10 8
2
0 7
10 7
0


Output

12.489995996796796
9.899494936611665

Solution (in CPP):

Solution:
#include<iostream>
#include<iomanip>
#include<vector>
#include<complex>
#include<map>
#include<stack>

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<P,D> C;

const D EPS = 1e-8;
const D PI = acos(-1);

inline P unit(P p){return p/abs(p);}
inline D dot(P x, P y){return real(conj(x)*y);}
inline D cross(P x, P y){return imag(conj(x)*y);}

inline P rotate(P v, D s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

inline D arg(D a,D b,D c){return acos( (b*b+c*c-a*a)/(2*b*c) );}

inline int cpr(C a,C b){
  D d = abs(a.fs-b.fs);
  if(a.sc+b.sc + EPS < d)return -1;      //no cross point (outside)
  if(b.sc+d + EPS < a.sc)return 1;       //no cross point (inside,B in A)
  if(a.sc+d + EPS < b.sc)return 2;       //no cross point (inside,A in B)
  if(abs(a.sc+b.sc - d) < EPS)return -3; //one cross point (outside)
  if(abs(b.sc+d - a.sc) < EPS)return 3;  //one cross point (inside,B in A)
  if(abs(a.sc+d - b.sc) < EPS)return 4;  //one cross point (inside,A in B)
  return 0;                              //two cross point
}

inline vector<P> cp_cir_to_cir(C a, C b){
  vector<P> v;
  int pos = cpr(a,b);
  if(pos==0){
    D s = arg(b.sc,abs(b.fs-a.fs),a.sc);
    P x = a.sc * unit(b.fs - a.fs);
    v.pb(a.fs + rotate(x,s));
    v.pb(a.fs + rotate(x,-s));
  }else if(abs(pos) >= 3){
    v.pb(a.fs + a.sc * unit(b.fs-a.fs));
  }
  return v;
}

int main(){
  int n;
  while(cin >> n){
    if(n==0)return 0;

    D res = 0;
    vector<C> circles;
    for(int i=0;i<n;i++){
      int x,r;
      cin >> x >> r;
      circles.pb(C(P(x,0),r));
      res = max(res, sqrt(2)*r);
    }

    vector<D> position(n-1), height(n-1);
    for(int i=0;i<n-1;i++){
      P cp = cp_cir_to_cir(circles[i], circles[i+1])[0];
      position[i] = cp.real(); height[i] = cp.imag();
    }

    vector<D> L(n-1), R(n-1);
    stack<int> S;
    for(int i=0;i<n-1;i++){
      while(S.size() && height[S.top()]+EPS > height[i])S.pop();
      L[i] = S.size()?S.top()+1:0;
      S.push(i);
    }

    while(S.size())S.pop();
    for(int i=n-2;i>=0;i--){
      while(S.size() && height[S.top()]+EPS > height[i])S.pop();
      R[i] = S.size()?S.top()-1:n-2;
      S.push(i);
    }

    for(int i=0;i<n-1;i++){
      int l = L[i], r = R[i]+1;
      D h = height[i];
      D r1 = circles[l].sc, r2 = circles[r].sc;

      D a = 0, b = min(r1,r2), d = circles[r].fs.real() - circles[l].fs.real();
      for(int hoge=0;hoge<50;hoge++){
	D mid = (a+b)/2;
	if( sqrt(r1*r1-mid*mid) + sqrt(r2*r2-mid*mid) + d > 2*mid)a = mid;
	else b = mid;
      }
      res = max(res, min(2*h, 2*a) );
    }

    cout << fixed << setprecision(10) << res << endl;
  }
}