#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

#include <complex>
typedef complex<double> P;
#define EPS (1e-8)
#define EQ(x,y) (abs((x)-(h))<EPS)
#define LT(x,y) ((x)-(y)<=-EPS)
#define LE(x,y) ((x)-(y)<+EPS)
const double PI=acos(-1.0);

double dot(P a,P b){
    return (a.real()*b.real()+a.imag()*b.imag());
}
double cross(P a,P b){
    return (a.real()*b.imag()-a.imag()*b.real());
}
double distance_l_p(P a,P b,P c){
    return abs(cross(b-a,c-a))/abs(b-a);
}
bool interpoint_lc(P a,P b,P c,double r,P ans[]){
    double di=distance_l_p(a,b,c);
    if(di+EPS>r)return false;
    P v=(a-b)/abs(a-b);
    P rv=v*P(0,1)*di;
    if(distance_l_p(a,b,c+rv)>di+EPS)rv=-rv;
    v*=sqrt(r*r-di*di);
    ans[0]=c+rv-v;
    ans[1]=c+rv+v;
    return true;
}
vector<P> cross_circles(P c1,double r1,P c2,double r2){
    double d=abs(c2-c1);
    if(LT(r1+r2,d)||LT(d,fabs(r1-r2)))
        return vector<P>();
    double l=0.5*((r1*r1-r2*r2)/d+d);
    double h=sqrt(r1*r1-l*l);
    vector<P> ret(2);
    ret[0]=P(l,+h)*(c2-c1)/d+c1;
    ret[1]=P(l,-h)*(c2-c1)/d+c1;
    return ret;
}
double distance_ls_p(P a,P b,P c){
    if(dot(b-a,c-a)<EPS)return abs(c-a);
    if(dot(a-b,c-b)<EPS)return abs(c-b);
    return abs(cross(b-a,c-a))/abs(b-a);
}
int n,w;
double get_dist(double r,int h){
    return sqrt(r*r-(r-h)*(r-h));
}
double get_dist(P a,P b){
    double dx=a.real()-b.real();
    double dy=a.imag()-b.imag();
    return sqrt(dx*dx+dy*dy);
}
bool ok(vi &x,vi &y,vi &h,double r){
    vector<pair<P,double> > circles;
    vector<pair<P,P> > lines;
    REP(i,n){
        if(LE(r,h[i])){
            circles.push_back(make_pair(P(x[i],y[i]),r));
        }else{
            double d=get_dist(r,h[i]);
            circles.push_back(make_pair(P(x[i],y[i]),d));
        }
    }

    double d;
    if(LE(r,w)){
        d=r;
    }else{
        d=get_dist(r,w);
    }
    lines.push_back(make_pair(P(0,d),P(100,d)));
    lines.push_back(make_pair(P(0,100-d),P(100,100-d)));
    lines.push_back(make_pair(P(d,0),P(d,100)));
    lines.push_back(make_pair(P(100-d,0),P(100-d,100)));

    vector<P> points;
    REP(i,circles.size()){
        FOR(j,i+1,circles.size()){
            vector<P> c=cross_circles(circles[i].first,circles[i].second,circles[j].first,circles[j].second);
            if(c.size()){
                points.push_back(c[0]);
                points.push_back(c[1]);
            }
        }
        REP(j,lines.size()){
            P c[2];
            if(interpoint_lc(lines[j].first,lines[j].second,circles[i].first,circles[i].second,c)){
                points.push_back(c[0]);
                points.push_back(c[1]);
            }
        }
    }
    points.push_back(P(d,d));
    points.push_back(P(100-d,d));
    points.push_back(P(d,100-d));
    points.push_back(P(100-d,100-d));

    vector<pair<P,P> > walls;
    walls.push_back(make_pair(P(0,0),P(100,0)));
    walls.push_back(make_pair(P(0,100-0),P(100,100-0)));
    walls.push_back(make_pair(P(0,0),P(0,100)));
    walls.push_back(make_pair(P(100-0,0),P(100-0,100)));

    /*
    cerr<<"circles"<<endl;
    REP(i,circles.size()){
        cerr<<circles[i].first.real()<<" "<<circles[i].first.imag()<<" "<<circles[i].second<<endl;
    }
    cerr<<"lines"<<endl;
    REP(i,lines.size()){
        cerr<<lines[i].first.real()<<" "<<lines[i].first.imag()<<" "<<lines[i].second.real()<<" "<<lines[i].second.imag()<<endl;
    }
    cerr<<"points"<<endl;
    REP(i,points.size()){
        cerr<<points[i].real()<<" "<<points[i].imag()<<endl;
    }
    */
    bool can=false;
    REP(i,points.size()){
        if(LT(points[i].real(),0)||LT(points[i].imag(),0)||LT(100,points[i].real())||LT(100,points[i].imag())){
            continue;
        }
        bool tmp=true;
        REP(j,n){
            double d1=(LE(r,h[j])?r:get_dist(r,h[j]));
            if(LT(get_dist(points[i],P(x[j],y[j])),d1)){
                /*
                cerr<<i<<"-(needle)-"<<j<<endl;
                cerr<<get_dist(points[i],P(x[j],y[j]))<<" "<<d1<<endl;
                */
                tmp=false;
            }
        }
        REP(j,lines.size()){
            double d2=(LE(r,w)?r:get_dist(r,w));
            if(LT(distance_l_p(walls[j].first,walls[j].second,points[i]),d2)){
                /*
                cerr<<i<<"-(wall)-"<<j<<endl;
                cerr<<distance_l_p(walls[j].first,walls[j].second,points[i])<<" "<<d2<<endl;
                */
                tmp=false;
            }
        }
        if(tmp){
            can=true;
            break;
        }
    }
    return can;
}
int main(){
    cout.precision(30);
    while(cin>>n>>w,n|w){
        vi x(n),y(n),h(n);
        REP(i,n){
            cin>>x[i]>>y[i]>>h[i];
        }

        /*
        ok(x,y,h,100);
        continue;
        */
        double lb=0,ub=100000;
        REP(i,1000){
            double mid=(lb+ub)/2;
            if(!ok(x,y,h,mid)){
                ub=mid;
            }else{
                lb=mid;
            }
        }
        cout<<ub<<endl;
    }
}
### Prompt

Please provide a cpp coded solution to the problem described below:

An open-top box having a square bottom is placed on the floor. You see a number of needles vertically planted on its bottom.

You want to place a largest possible spheric balloon touching the box bottom, interfering with none of the side walls nor the needles.

Java Specific: Submitted Java programs may not use "java.awt.geom.Area". You may use it for your debugging purposes.

Figure H.1 shows an example of a box with needles and the corresponding largest spheric balloon. It corresponds to the first dataset of the sample input below.

<image>
Figure H.1. The upper shows an example layout and the lower shows the largest spheric balloon that can be placed.



Input

The input is a sequence of datasets. Each dataset is formatted as follows.


n w
x1 y1 h1
:
xn yn hn


The first line of a dataset contains two positive integers, n and w, separated by a space. n represents the number of needles, and w represents the height of the side walls.

The bottom of the box is a 100 × 100 square. The corners of the bottom face are placed at positions (0, 0, 0), (0, 100, 0), (100, 100, 0), and (100, 0, 0).

Each of the n lines following the first line contains three integers, xi, yi, and hi. (xi, yi, 0) and hi represent the base position and the height of the i-th needle. No two needles stand at the same position.

You can assume that 1 ≤ n ≤ 10, 10 ≤ w ≤ 200, 0 < xi < 100, 0 < yi < 100 and 1 ≤ hi ≤ 200. You can ignore the thicknesses of the needles and the walls.

The end of the input is indicated by a line of two zeros. The number of datasets does not exceed 1000.

Output

For each dataset, output a single line containing the maximum radius of a balloon that can touch the bottom of the box without interfering with the side walls or the needles. The output should not contain an error greater than 0.0001.

Example

Input

5 16
70 66 40
38 52 20
40 35 10
70 30 10
20 60 10
1 100
54 75 200
1 10
90 10 1
1 11
54 75 200
3 10
53 60 1
61 38 1
45 48 1
4 10
20 20 10
20 80 10
80 20 10
80 80 10
0 0


Output

26.00000
39.00000
130.00000
49.49777
85.00000
95.00000

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

#include <complex>
typedef complex<double> P;
#define EPS (1e-8)
#define EQ(x,y) (abs((x)-(h))<EPS)
#define LT(x,y) ((x)-(y)<=-EPS)
#define LE(x,y) ((x)-(y)<+EPS)
const double PI=acos(-1.0);

double dot(P a,P b){
    return (a.real()*b.real()+a.imag()*b.imag());
}
double cross(P a,P b){
    return (a.real()*b.imag()-a.imag()*b.real());
}
double distance_l_p(P a,P b,P c){
    return abs(cross(b-a,c-a))/abs(b-a);
}
bool interpoint_lc(P a,P b,P c,double r,P ans[]){
    double di=distance_l_p(a,b,c);
    if(di+EPS>r)return false;
    P v=(a-b)/abs(a-b);
    P rv=v*P(0,1)*di;
    if(distance_l_p(a,b,c+rv)>di+EPS)rv=-rv;
    v*=sqrt(r*r-di*di);
    ans[0]=c+rv-v;
    ans[1]=c+rv+v;
    return true;
}
vector<P> cross_circles(P c1,double r1,P c2,double r2){
    double d=abs(c2-c1);
    if(LT(r1+r2,d)||LT(d,fabs(r1-r2)))
        return vector<P>();
    double l=0.5*((r1*r1-r2*r2)/d+d);
    double h=sqrt(r1*r1-l*l);
    vector<P> ret(2);
    ret[0]=P(l,+h)*(c2-c1)/d+c1;
    ret[1]=P(l,-h)*(c2-c1)/d+c1;
    return ret;
}
double distance_ls_p(P a,P b,P c){
    if(dot(b-a,c-a)<EPS)return abs(c-a);
    if(dot(a-b,c-b)<EPS)return abs(c-b);
    return abs(cross(b-a,c-a))/abs(b-a);
}
int n,w;
double get_dist(double r,int h){
    return sqrt(r*r-(r-h)*(r-h));
}
double get_dist(P a,P b){
    double dx=a.real()-b.real();
    double dy=a.imag()-b.imag();
    return sqrt(dx*dx+dy*dy);
}
bool ok(vi &x,vi &y,vi &h,double r){
    vector<pair<P,double> > circles;
    vector<pair<P,P> > lines;
    REP(i,n){
        if(LE(r,h[i])){
            circles.push_back(make_pair(P(x[i],y[i]),r));
        }else{
            double d=get_dist(r,h[i]);
            circles.push_back(make_pair(P(x[i],y[i]),d));
        }
    }

    double d;
    if(LE(r,w)){
        d=r;
    }else{
        d=get_dist(r,w);
    }
    lines.push_back(make_pair(P(0,d),P(100,d)));
    lines.push_back(make_pair(P(0,100-d),P(100,100-d)));
    lines.push_back(make_pair(P(d,0),P(d,100)));
    lines.push_back(make_pair(P(100-d,0),P(100-d,100)));

    vector<P> points;
    REP(i,circles.size()){
        FOR(j,i+1,circles.size()){
            vector<P> c=cross_circles(circles[i].first,circles[i].second,circles[j].first,circles[j].second);
            if(c.size()){
                points.push_back(c[0]);
                points.push_back(c[1]);
            }
        }
        REP(j,lines.size()){
            P c[2];
            if(interpoint_lc(lines[j].first,lines[j].second,circles[i].first,circles[i].second,c)){
                points.push_back(c[0]);
                points.push_back(c[1]);
            }
        }
    }
    points.push_back(P(d,d));
    points.push_back(P(100-d,d));
    points.push_back(P(d,100-d));
    points.push_back(P(100-d,100-d));

    vector<pair<P,P> > walls;
    walls.push_back(make_pair(P(0,0),P(100,0)));
    walls.push_back(make_pair(P(0,100-0),P(100,100-0)));
    walls.push_back(make_pair(P(0,0),P(0,100)));
    walls.push_back(make_pair(P(100-0,0),P(100-0,100)));

    /*
    cerr<<"circles"<<endl;
    REP(i,circles.size()){
        cerr<<circles[i].first.real()<<" "<<circles[i].first.imag()<<" "<<circles[i].second<<endl;
    }
    cerr<<"lines"<<endl;
    REP(i,lines.size()){
        cerr<<lines[i].first.real()<<" "<<lines[i].first.imag()<<" "<<lines[i].second.real()<<" "<<lines[i].second.imag()<<endl;
    }
    cerr<<"points"<<endl;
    REP(i,points.size()){
        cerr<<points[i].real()<<" "<<points[i].imag()<<endl;
    }
    */
    bool can=false;
    REP(i,points.size()){
        if(LT(points[i].real(),0)||LT(points[i].imag(),0)||LT(100,points[i].real())||LT(100,points[i].imag())){
            continue;
        }
        bool tmp=true;
        REP(j,n){
            double d1=(LE(r,h[j])?r:get_dist(r,h[j]));
            if(LT(get_dist(points[i],P(x[j],y[j])),d1)){
                /*
                cerr<<i<<"-(needle)-"<<j<<endl;
                cerr<<get_dist(points[i],P(x[j],y[j]))<<" "<<d1<<endl;
                */
                tmp=false;
            }
        }
        REP(j,lines.size()){
            double d2=(LE(r,w)?r:get_dist(r,w));
            if(LT(distance_l_p(walls[j].first,walls[j].second,points[i]),d2)){
                /*
                cerr<<i<<"-(wall)-"<<j<<endl;
                cerr<<distance_l_p(walls[j].first,walls[j].second,points[i])<<" "<<d2<<endl;
                */
                tmp=false;
            }
        }
        if(tmp){
            can=true;
            break;
        }
    }
    return can;
}
int main(){
    cout.precision(30);
    while(cin>>n>>w,n|w){
        vi x(n),y(n),h(n);
        REP(i,n){
            cin>>x[i]>>y[i]>>h[i];
        }

        /*
        ok(x,y,h,100);
        continue;
        */
        double lb=0,ub=100000;
        REP(i,1000){
            double mid=(lb+ub)/2;
            if(!ok(x,y,h,mid)){
                ub=mid;
            }else{
                lb=mid;
            }
        }
        cout<<ub<<endl;
    }
}
```