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 <bits/stdc++.h>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

typedef double D;
typedef complex<D> P;

#define X real()
#define Y imag()

const D eps=1e-9;
const D inf=1e12;
const D PI=acos(-1);

bool cmp_x(const P& a,const P& b){ return a.X==b.X?a.Y<b.Y:a.X<b.X; }
bool cmp_y(const P& a,const P& b){ return a.Y==b.Y?a.X<b.X:a.Y<b.Y; }
bool cmp_a(const P& a,const P& b){ return arg(a)==arg(b)?norm(a)<norm(b):arg(a)<arg(b); }
D cross(P a,P b){ return (conj(a)*b).Y; }
D dot(P a,P b){ return (conj(a)*b).X; }
D toRag(D deg){ return deg*PI/180.0; }
P rot(P base,P a,D theta){ return base+polar(abs(a-base),arg(a-base)+theta); }

struct C{
  P p; D r;
  C(const P& p,D r):p(p),r(r){}
};

void crosspointCC(const C& c1,const C& c2,P& p1,P& p2){
  D x1=c2.p.X-c1.p.X,y1=c2.p.Y-c1.p.Y;
  D r1=c1.r,r2=c2.r;
  D a=(x1*x1+y1*y1+r1*r1-r2*r2)/2.0;
  p1=P(((a*x1+y1*sqrt((x1*x1+y1*y1)*r1*r1-a*a))/(x1*x1+y1*y1))+c1.p.X,((a*y1-x1*sqrt((x1*x1+y1*y1)*r1*r1-a*a))/(x1*x1+y1*y1))+c1.p.Y);
  p2=P(((a*x1-y1*sqrt((x1*x1+y1*y1)*r1*r1-a*a))/(x1*x1+y1*y1))+c1.p.X,((a*y1+x1*sqrt((x1*x1+y1*y1)*r1*r1-a*a))/(x1*x1+y1*y1))+c1.p.Y);
}

int N;
int X0[50010],R[50010];
double l[50010],r[50010];
double crtl[50010],crtr[50010];

bool ok(double H){
  rep(i,N){
    if((double)R[i]<H){
      crtl[i]=-inf; crtr[i]=-inf;
      continue;
    }
    crtl[i]=max(l[i],X0[i]-sqrt(pow((double)R[i],2)-pow(H,2)));
    crtr[i]=min(r[i],X0[i]+sqrt(pow((double)R[i],2)-pow(H,2)));
    if(crtl[i]>crtr[i]){
      crtl[i]=-inf; crtr[i]=-inf;
    }
  }
  double mx=0,crt=0;
  rep(i,N){
    if(abs(l[i]-crtl[i])>eps){
      crt=0;
    }
    crt+=crtr[i]-crtl[i];
    maxch(mx,crt);
    if(abs(r[i]-crtr[i])>eps){
      crt=0;
    }
  }
  return mx>H*2-eps;
}

int main(){
  while(1){
    scanf("%d",&N);
    if(N==0)break;
    vector<C> cs;
    rep(i,N){
      scanf("%d%d",X0+i,R+i);
      cs.push_back(C(P(X0[i],0),R[i]));
    }
    l[0]=X0[0]-R[0];
    rep(i,N-1){
      P p1,p2;
      crosspointCC(cs[i],cs[i+1],p1,p2);
      r[i]=p1.X; l[i+1]=p1.X;
    }
    r[N-1]=X0[N-1]+R[N-1];

    double lb=0,ub=5e5;
    rep(_,50){
      double mid=(lb+ub)/2.0;
      if(ok(mid))lb=mid;
      else ub=mid;
    }
    printf("%.10f\n", 2.0*lb);
  }
  return 0;
}