Problem:
Problem H:
Don't Burst the Balloon
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.
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
x
1
y
1
h
1
:
x
n
y
n
h
n
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,
x
i
,
y
i
, and
h
i
. (
x
i
,
y
i
, 0) and
h
i
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 <
x
i
< 100, 0 <
y
i
< 100 and 1 ≤
h
i
≤ 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.
Sample 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 for the Sample Input
26.00000
39.00000
130.00000
49.49777
85.00000
95.00000

Submitted solutions:

code_snippet: #include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rrep(i, a, b) for (ll i = (ll)(b)-1; i >= (ll)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())

using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;

template <typename T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
    return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
    return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
    return (x == 0 ? -1 : __builtin_ctzll(x));
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "P(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
    cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
    for (; a[i] != ',' && a[i] != '\0'; i++)
        cerr << a[i];
    cerr << ":" << b << " ";
    _show(i + 1, a, c...);
}

/**
 * @brief template
 */

using T = long double;
const T eps = 1e-8;
using Point = complex<T>;
using Poly = vector<Point>;
#define X real()
#define Y imag()
template <typename T> inline bool eq(const T &a, const T &b) {
    return fabs(a - b) < eps;
}
bool cmp(const Point &a, const Point &b) {
    auto sub = [&](Point a) {
        return (a.Y < 0 ? -1 : (a.Y == 0 && a.X >= 0 ? 0 : 1));
    };
    if (sub(a) != sub(b))
        return sub(a) < sub(b);
    return a.Y * b.X < a.X * b.Y;
}
struct Line {
    Point a, b, dir;
    Line() {}
    Line(Point _a, Point _b) : a(_a), b(_b), dir(b - a) {}
    Line(T A, T B, T C) {
        if (eq(A, (T).0)) {
            a = Point(0, C / B), b = Point(1 / C / B);
        } else if (eq(B, (T).0)) {
            a = Point(C / A, 0), b = Point(C / A, 1);
        } else {
            a = Point(0, C / B), b = Point(C / A, 0);
        }
    }
};
struct Segment : Line {
    Segment() {}
    Segment(Point _a, Point _b) : Line(_a, _b) {}
};
struct Circle {
    Point p;
    T r;
    Circle() {}
    Circle(Point _p, T _r) : p(_p), r(_r) {}
};

istream &operator>>(istream &is, Point &p) {
    T x, y;
    is >> x >> y;
    p = Point(x, y);
    return is;
}
ostream &operator<<(ostream &os, Point &p) {
    os << fixed << setprecision(12) << p.X << ' ' << p.Y;
    return os;
}
Point unit(const Point &a) {
    return a / abs(a);
}
T dot(const Point &a, const Point &b) {
    return a.X * b.X + a.Y * b.Y;
}
T cross(const Point &a, const Point &b) {
    return a.X * b.Y - a.Y * b.X;
}
Point rot(const Point &a, const T &theta) {
    return Point(cos(theta) * a.X - sin(theta) * a.Y,
                 sin(theta) * a.X + cos(theta) * a.Y);
}
Point rot90(const Point &a) {
    return Point(-a.Y, a.X);
}
T arg(const Point &a, const Point &b, const Point &c) {
    double ret = acos(dot(a - b, c - b) / abs(a - b) / abs(c - b));
    if (cross(a - b, c - b) < 0)
        ret = -ret;
    return ret;
}

Point Projection(const Line &l, const Point &p) {
    T t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
    return l.a + (l.a - l.b) * t;
}
Point Projection(const Segment &l, const Point &p) {
    T t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
    return l.a + (l.a - l.b) * t;
}
Point Reflection(const Line &l, const Point &p) {
    return p + (Projection(l, p) - p) * (T)2.;
}
int ccw(const Point &a, Point b, Point c) {
    b -= a;
    c -= a;
    if (cross(b, c) > eps)
        return 1; // ccw

    if (cross(b, c) < -eps)
        return -1; // cw

    if (dot(b, c) < 0)
        return 2; // c,a,b

    if (norm(b) < norm(c))
        return -2; // a,b,c

    return 0;      // a,c,b

}
bool isOrthogonal(const Line &a, const Line &b) {
    return eq(dot(a.b - a.a, b.b - b.a), (T).0);
}
bool isParallel(const Line &a, const Line &b) {
    return eq(cross(a.b - a.a, b.b - b.a), (T).0);
}
bool isIntersect(const Segment &a, const Segment &b) {
    return ccw(a.a, a.b, b.a) * ccw(a.a, a.b, b.b) <= 0 and
           ccw(b.a, b.b, a.a) * ccw(b.a, b.b, a.b) <= 0;
}
int isIntersect(const Circle &a, const Circle &b) {
    T d = abs(a.p - b.p);
    if (d > a.r + b.r + eps)
        return 4;
    if (eq(d, a.r + b.r))
        return 3;
    if (eq(d, abs(a.r - b.r)))
        return 1;
    if (d < abs(a.r - b.r) - eps)
        return 0;
    return 2;
}
T Dist(const Line &a, const Point &b) {
    Point c = Projection(a, b);
    return abs(c - b);
}
T Dist(const Segment &a, const Point &b) {
    if (dot(a.b - a.a, b - a.a) < eps)
        return abs(b - a.a);
    if (dot(a.a - a.b, b - a.b) < eps)
        return abs(b - a.b);
    return abs(cross(a.b - a.a, b - a.a)) / abs(a.b - a.a);
}
T Dist(const Segment &a, const Segment &b) {
    if (isIntersect(a, b))
        return (T).0;
    T res = min({Dist(a, b.a), Dist(a, b.b), Dist(b, a.a), Dist(b, a.b)});
    return res;
}
Point Intersection(const Line &a, const Line &b) {
    T d1 = cross(a.b - a.a, b.b - b.a);
    T d2 = cross(a.b - a.a, a.b - b.a);
    if (eq(d1, (T)0.) and eq(d2, (T)0.))
        return b.a;
    return b.a + (b.b - b.a) * (d2 / d1);
}
Poly Intersection(const Circle &a, const Line &b) {
    Poly res;
    T d = Dist(b, a.p);
    if (d > a.r + eps)
        return res;
    Point h = Projection(b, a.p);
    if (eq(d, a.r)) {
        res.push_back(h);
        return res;
    }
    Point e = unit(b.b - b.a);
    T ph = sqrt(a.r * a.r - d * d);
    res.push_back(h - e * ph);
    res.push_back(h + e * ph);
    return res;
}
Poly Intersection(const Circle &a, const Segment &b) {
    Line c(b.a, b.b);
    Poly sub = Intersection(a, c);
    double xmi = min(b.a.X, b.b.X), xma = max(b.a.X, b.b.X);
    double ymi = min(b.a.Y, b.b.Y), yma = max(b.a.Y, b.b.Y);
    Poly res;
    rep(i, 0, sub.size()) {
        if (xmi <= sub[i].X + eps and sub[i].X - eps <= xma and
            ymi <= sub[i].Y + eps and sub[i].Y - eps <= yma) {
            res.push_back(sub[i]);
        }
    }
    return res;
}
Poly Intersection(const Circle &a, const Circle &b) {
    Poly res;
    int mode = isIntersect(a, b);
    T d = abs(a.p - b.p);
    if (mode == 4 or mode == 0)
        return res;
    if (mode == 3) {
        T t = a.r / (a.r + b.r);
        res.push_back(a.p + (b.p - a.p) * t);
        return res;
    }
    if (mode == 1) {
        if (b.r < a.r - eps) {
            res.push_back(a.p + (b.p - a.p) * (a.r / d));
        } else {
            res.push_back(b.p + (a.p - b.p) * (b.r / d));
        }
        return res;
    }
    T rc = (a.r * a.r + d * d - b.r * b.r) / d / (T)2.;
    T rs = sqrt(a.r * a.r - rc * rc);
    if (a.r - abs(rc) < eps)
        rs = 0;
    Point e = unit(b.p - a.p);
    res.push_back(a.p + rc * e + rs * e * Point(0, 1));
    res.push_back(a.p + rc * e + rs * e * Point(0, -1));
    return res;
}
Poly HalfplaneIntersection(vector<Line> &H) {
    sort(ALL(H), [&](Line &l1, Line &l2) { return cmp(l1.dir, l2.dir); });
    auto outside = [&](Line &L, Point p) -> bool {
        return cross(L.dir, p - L.a) < -eps;
    };
    deque<Line> deq;
    int sz = 0;
    rep(i, 0, SZ(H)) {
        while (sz > 1 and
               outside(H[i], Intersection(deq[sz - 1], deq[sz - 2]))) {
            deq.pop_back();
            sz--;
        }
        while (sz > 1 and outside(H[i], Intersection(deq[0], deq[1]))) {
            deq.pop_front();
            sz--;
        }
        if (sz > 0 and fabs(cross(H[i].dir, deq[sz - 1].dir)) < eps) {
            if (dot(H[i].dir, deq[sz - 1].dir) < 0) {
                return {};
            }
            if (outside(H[i], deq[sz - 1].a)) {
                deq.pop_back();
                sz--;
            } else
                continue;
        }
        deq.push_back(H[i]);
        sz++;
    }

    while (sz > 2 and outside(deq[0], Intersection(deq[sz - 1], deq[sz - 2]))) {
        deq.pop_back();
        sz--;
    }
    while (sz > 2 and outside(deq[sz - 1], Intersection(deq[0], deq[1]))) {
        deq.pop_front();
        sz--;
    }
    if (sz < 3)
        return {};
    deq.push_back(deq.front());
    Poly ret;
    rep(i, 0, sz) ret.push_back(Intersection(deq[i], deq[i + 1]));
    return ret;
}

T Area(const Poly &a) {
    T res = 0;
    int n = a.size();
    rep(i, 0, n) res += cross(a[i], a[(i + 1) % n]);
    return fabs(res / (T)2.);
}
T Area(const Poly &a, const Circle &b) {
    int n = a.size();
    if (n < 3)
        return (T).0;
    auto rec = [&](auto self, const Circle &c, const Point &p1,
                   const Point &p2) {
        Point va = c.p - p1, vb = c.p - p2;
        T f = cross(va, vb), res = (T).0;
        if (eq(f, (T).0))
            return res;
        if (max(abs(va), abs(vb)) < c.r + eps)
            return f;
        if (Dist(Segment(p1, p2), c.p) > c.r - eps)
            return c.r * c.r * arg(vb * conj(va));
        auto u = Intersection(c, Segment(p1, p2));
        Poly sub;
        sub.push_back(p1);
        for (auto &x : u)
            sub.push_back(x);
        sub.push_back(p2);
        rep(i, 0, sub.size() - 1) res += self(self, c, sub[i], sub[i + 1]);
        return res;
    };
    T res = (T).0;
    rep(i, 0, n) res += rec(rec, b, a[i], a[(i + 1) % n]);
    return fabs(res / (T)2.);
}
T Area(const Circle &a, const Circle &b) {
    T d = abs(a.p - b.p);
    if (d >= a.r + b.r - eps)
        return (T).0;
    if (d <= abs(a.r - b.r) + eps) {
        T r = min(a.r, b.r);
        return M_PI * r * r;
    }
    T ath = acos((a.r * a.r + d * d - b.r * b.r) / d / a.r / (T)2.);
    T res = a.r * a.r * (ath - sin(ath * 2) / (T)2.);
    T bth = acos((b.r * b.r + d * d - a.r * a.r) / d / b.r / (T)2.);
    res += b.r * b.r * (bth - sin(bth * 2) / (T)2.);
    return fabs(res);
}
bool isConvex(const Poly &a) {
    int n = a.size();
    int cur, pre, nxt;
    rep(i, 0, n) {
        pre = (i - 1 + n) % n;
        nxt = (i + 1) % n;
        cur = i;
        if (ccw(a[pre], a[cur], a[nxt]) == -1)
            return 0;
    }
    return 1;
}
int isContained(const Poly &a,
                const Point &b) { // 0:not contain,1:on edge,2:contain

    bool res = 0;
    int n = a.size();
    rep(i, 0, n) {
        Point p = a[i] - b, q = a[(i + 1) % n] - b;
        if (p.Y > q.Y)
            swap(p, q);
        if (p.Y < eps and eps < q.Y and cross(p, q) > eps)
            res ^= 1;
        if (eq(cross(p, q), (T).0) and dot(p, q) < eps)
            return 1;
    }
    return (res ? 2 : 0);
}
Poly ConvexHull(Poly &a) {
    sort(ALL(a), [](const Point &p, const Point &q) {
        return (eq(p.Y, q.Y) ? p.X < q.X : p.Y < q.Y);
    });
    a.erase(unique(ALL(a)), a.end());
    int n = a.size(), k = 0;
    Poly res(n * 2);
    for (int i = 0; i < n; res[k++] = a[i++]) {
        while (k >= 2 and
               cross(res[k - 1] - res[k - 2], a[i] - res[k - 1]) < eps)
            k--;
    }
    for (int i = n - 2, t = k + 1; i >= 0; res[k++] = a[i--]) {
        while (k >= t and
               cross(res[k - 1] - res[k - 2], a[i] - res[k - 1]) < eps)
            k--;
    }
    res.resize(k - 1);
    return res;
}
T Diam(const Poly &a) {
    int n = a.size();
    int x = 0, y = 0;
    rep(i, 1, n) {
        if (a[i].Y > a[x].Y)
            x = i;
        if (a[i].Y < a[y].Y)
            y = i;
    }
    T res = abs(a[x] - a[y]);
    int i = x, j = y;
    do {
        if (cross(a[(i + 1) % n] - a[i], a[(j + 1) % n] - a[j]) < 0)
            i = (i + 1) % n;
        else
            j = (j + 1) % n;
        chmax(res, abs(a[i] - a[j]));
    } while (i != x or j != y);
    return res;
}
Poly Cut(const Poly &a, const Line &l) {
    int n = a.size();
    Poly res;
    rep(i, 0, n) {
        Point p = a[i], q = a[(i + 1) % n];
        if (ccw(l.a, l.b, p) != -1)
            res.push_back(p);
        if (ccw(l.a, l.b, p) * ccw(l.a, l.b, q) < 0)
            res.push_back(Intersection(Line(p, q), l));
    }
    return res;
}

T Closest(Poly &a) {
    int n = a.size();
    if (n <= 1)
        return 0;
    sort(ALL(a), [&](Point a, Point b) {
        return (eq(a.X, b.X) ? a.Y < b.Y : a.X < b.X);
    });
    Poly buf(n);
    auto rec = [&](auto self, int lb, int rb) -> T {
        if (rb - lb <= 1)
            return (T)INF;
        int mid = (lb + rb) >> 1;
        auto x = a[mid].X;
        T res = min(self(self, lb, mid), self(self, mid, rb));
        inplace_merge(a.begin() + lb, a.begin() + mid, a.begin() + rb,
                      [&](auto p, auto q) { return p.Y < q.Y; });
        int ptr = 0;
        rep(i, lb, rb) {
            if (abs(a[i].X - x) >= res)
                continue;
            rep(j, 0, ptr) {
                auto sub = a[i] - buf[ptr - 1 - j];
                if (sub.Y >= res)
                    break;
                chmin(res, abs(sub));
            }
            buf[ptr++] = a[i];
        }
        return res;
    };
    return rec(rec, 0, n);
}

Circle Incircle(const Point &a, const Point &b, const Point &c) {
    T A = abs(b - c), B = abs(c - a), C = abs(a - b);
    Point p(A * a.X + B * b.X + C * c.X, A * a.Y + B * b.Y + C * c.Y);
    p /= (A + B + C);
    T r = Dist(Line(a, b), p);
    return Circle(p, r);
}
Circle Circumcircle(const Point &a, const Point &b, const Point &c) {
    Line l1((a + b) / (T)2., (a + b) / (T)2. + (b - a) * Point(0, 1));
    Line l2((b + c) / (T)2., (b + c) / (T)2. + (c - b) * Point(0, 1));
    Point p = Intersection(l1, l2);
    return Circle(p, abs(p - a));
}
Poly tangent(const Point &a, const Circle &b) {
    return Intersection(b, Circle(a, sqrt(norm(b.p - a) - b.r * b.r)));
}
vector<Line> tangent(const Circle &a, const Circle &b) {
    vector<Line> res;
    T d = abs(a.p - b.p);
    if (eq(d, (T)0.))
        return res;
    Point u = unit(b.p - a.p);
    Point v = u * Point(0, 1);
    for (int t : {-1, 1}) {
        T h = (a.r + b.r * t) / d;
        if (eq(h * h, (T)1.)) {
            res.push_back(Line(a.p + (h > 0 ? u : -u) * a.r,
                               a.p + (h > 0 ? u : -u) * a.r + v));
        } else if (1 > h * h) {
            Point U = u * h, V = v * sqrt(1 - h * h);
            res.push_back(Line(a.p + (U + V) * a.r, b.p - (U + V) * (b.r * t)));
            res.push_back(Line(a.p + (U - V) * a.r, b.p - (U - V) * (b.r * t)));
        }
    }
    return res;
}

/**
 * @brief Geometry
 */

int main() {
while(1) {
    const long double L = 100.0L;
    int N;
    long double W;
    cin >> N >> W;
    if (N == 0) return 0;
    vector<Point> P(N);
    vector<long double> H(N);
    rep(i,0,N) {
        long double x, y;
        cin >> x >> y;
        P[i] = Point(x,y);
        cin >> H[i];
    }
    auto Judge = [&](long double M) -> bool {
        vector<Circle> C(N);
        rep(i,0,N) {
            if (M <= H[i]) C[i] = Circle(P[i],M);
            else C[i] = Circle(P[i],sqrt(M*H[i]*2.0L - H[i]*H[i]));
        }
        long double D;
        if (M <= W) D = M;
        else D = sqrt(M*W*2.0L - W*W);
        if (D >= 50.0) return false;
        vector<Segment> S(4);
        S[0] = Segment(Point(D,D),Point(D,L-D));
        S[1] = Segment(Point(D,D),Point(L-D,D));
        S[2] = Segment(Point(L-D,D),Point(L-D,L-D));
        S[3] = Segment(Point(D,L-D),Point(L-D,L-D));
        vector<Point> Cand;
        Cand.push_back(Point(D,D));
        Cand.push_back(Point(L-D,D));
        Cand.push_back(Point(D,L-D));
        Cand.push_back(Point(L-D,L-D));
        rep(i,0,4) {
            rep(j,0,N) {
                auto V = Intersection(C[j],S[i]);
                for (auto VP : V) Cand.push_back(VP);
            }
        }
        rep(i,0,N) {
            rep(j,i+1,N) {
                auto V = Intersection(C[i],C[j]);
                for (auto VP : V) {
                    if (D <= VP.real() && VP.real() <= L-D && D <= VP.imag() && VP.imag() <= L-D) Cand.push_back(VP);
                }
            }
        }
        for (auto PP : Cand) {
            bool check = true;
            rep(i,0,N) {
                if (abs(C[i].p-PP) < C[i].r - eps) {
                    check = false;
                    break;
                }
            }
            if (check) return true;
        }
        return false;
    };
    long double OK = 0.0L, NG = 140.0;
    rep(_,0,100) {
        long double MID = (OK + NG) / 2;
        if (Judge(MID)) OK = MID;
        else NG = MID;
    }
    printf("%.12Lf\n",(OK+NG)/2.0L);
}
}
accuracy: 1
time_ms: 630
memory_kb: 3560
final_rank: 6

code_snippet: #include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define per(i, n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define per2(i, l, r) for (int i = (r)-1; i >= (l); i--)
#define each(e, x) for (auto &e : x)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define eb emplace_back
#define MM << ' ' <<
#define TT template <typename T>
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

TT bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
TT bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }

TT using minheap = priority_queue<T, vector<T>, greater<T>>;
TT using maxheap = priority_queue<T>;

TT void print(vector<T> v, T x = 0) {
    int n = sz(v);
    rep(i, n) cout << v[i] + x << (i == n - 1 ? '\n' : ' ');
    if (n == 0) cout << '\n';
}

TT void printn(vector<T> v, T x = 0) {
    int n = sz(v);
    rep(i, n) cout << v[i] + x << '\n';
}

TT void rearrange(vector<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), end(v));
}

TT int lb(vector<T> &v, T x) { return lower_bound(all(v), x) - begin(v); }
TT int ub(vector<T> &v, T x) { return upper_bound(all(v), x) - begin(v); }

const int inf = (1 << 30) - 1;
const ll INF = (1LL << 60) - 1;

struct io_setup {
    io_setup() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout << fixed << setprecision(15);
    }
} io_setup;

#define X(p) real(p)
#define Y(p) imag(p)
using R = double;
using P = complex<R>;
using VP = vector<P>;

const R EPS = 1e-7;
const R pi = acos(-1.0);

struct C {
    P p;
    R r;
    C() {}
    C(P p, R r) : p(p), r(r) {}
};

P rot(P p, R t) {
    return p * P(cos(t), sin(t));
}

R dot(P p, P q) {
    return X(p) * X(q) + Y(p) * Y(q);
}

R dist(P p, P q) {
    return abs(p - q);
}

VP crosspoint(C c1, C c2) {
    R d = abs(c1.p - c2.p);
    R a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    R t = atan2(Y(c2.p) - Y(c1.p), X(c2.p) - X(c1.p));
    VP ret;
    if (d < max(c1.r, c2.r) - min(c1.r, c2.r) || c1.r + c2.r < d)
        return ret;
    P p1 = c1.p + rot(P(c1.r, 0.0), t + a);
    P p2 = c1.p + rot(P(c1.r, 0.0), t - a);
    ret.eb(p1), ret.eb(p2);
    return ret;
}

int main() {
    auto calc = [](double h, double r) {
        chmin(h, r);
        return sqrt(r * r - (r - h) * (r - h));
    };
    auto cx = [](C c, R x) {
        VP ret;
        R d = abs(X(c.p) - x);
        if (d > c.r)
            return ret;
        R h = sqrt(c.r * c.r - d * d);
        ret.eb(x, Y(c.p) - h);
        ret.eb(x, Y(c.p) + h);
        return ret;
    };
    auto cy = [](C c, R y) {
        VP ret;
        R d = abs(Y(c.p) - y);
        if (d > c.r)
            return ret;
        R w = sqrt(c.r * c.r - d * d);
        ret.eb(X(c.p) - w, y);
        ret.eb(X(c.p) + w, y);
        return ret;
    };
    while (1) {
        int n, w;
        cin >> n >> w;
        if (!n)
            break;
        vector<int> x(n), y(n), h(n);
        rep(i, n) cin >> x[i] >> y[i] >> h[i];
        VP pn(n);
        rep(i, n) pn[i] = P(x[i], y[i]);
        double ok = 0, ng = 100000;
        rep(ti, 100) {
            double mid = (ok + ng) / 2;
            double dw = calc(w, mid);
            if (dw > 50) {
                ng = mid;
                continue;
            }
            vector<R> dn(n);
            rep(i, n) dn[i] = calc(h[i], mid);
            VP ls{P(50, 50)};
            rep(i, n) {
                C ci(pn[i], calc(h[i], mid));
                VP tmp;
                each(p, cx(ci, dw)) tmp.eb(p);
                each(p, cx(ci, 100 - dw)) tmp.eb(p);
                each(p, cy(ci, dw)) tmp.eb(p);
                each(p, cy(ci, 100 - dw)) tmp.eb(p);
                rep(j, n) if (i != j) each(p, crosspoint(ci, C(pn[j], dn[j]))) tmp.eb(p);
                if (empty(tmp))
                    ls.eb(pn[i] + P(mid, 0));
                each(p, tmp) ls.eb(p);
            }
            bool f = false;
            R bl = dw - EPS, br = 100 - dw + EPS;
            each(p, ls) {
                bool fl = (bl < min(X(p), Y(p)) && max(X(p), Y(p)) < br);
                rep(i, n) fl &= dist(p, pn[i]) > dn[i] - EPS;
                if (fl)
                    f = true;
            }
            (f ? ok : ng) = mid;
        }
        cout << ok << endl;
    }
}
accuracy: 1
time_ms: 980
memory_kb: 4024
final_rank: 16

code_snippet: //#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using QP = priority_queue<T,vector<T>,greater<T>>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T1,typename T2,typename T3>void anss(T1 x,T2 y,T3 z){ans(x!=y,x,z);};  
template<typename T>void debug(const T &v,ll h,ll w,string sv=" "){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout<<sv<<v[i][j];cout<<endl;}};
template<typename T>void debug(const T &v,ll n,string sv=" "){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout<<sv<<v[i];cout<<endl;};
template<typename T>void debug(const vector<T>&v){debug(v,v.size());}
template<typename T>void debug(const vector<vector<T>>&v){for(auto &vv:v)debug(vv,vv.size());}
template<typename T>void debug(stack<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(queue<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(deque<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop_front();}cout<<endl;}
template<typename T>void debug(PQ<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(QP<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(const set<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
template<typename T>void debug(const multiset<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
template<typename T,size_t size>void debug(const array<T, size> &a){for(auto z:a)cout<<z<<" ";cout<<endl;}
template<typename T,typename V>void debug(const map<T,V>&v){for(auto z:v)cout<<"["<<z.first<<"]="<<z.second<<",";cout<<endl;}
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
//vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << " " << p.second;}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;}
template<typename T>void rearrange(vector<int>&ord, vector<T>&v){
  auto tmp = v;
  for(int i=0;i<tmp.size();i++)v[i] = tmp[ord[i]];
}
template<typename Head, typename... Tail>void rearrange(vector<int>&ord,Head&& head, Tail&&... tail){
  rearrange(ord, head);
  rearrange(ord, tail...);
}
template<typename T> vector<int> ascend(const vector<T>&v){
  vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
  sort(ord.begin(),ord.end(),[&](int i,int j){return v[i]<v[j];});
  return ord;
}
template<typename T> vector<int> descend(const vector<T>&v){
  vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
  sort(ord.begin(),ord.end(),[&](int i,int j){return v[i]>v[j];});
  return ord;
}
template<typename T> vector<T> inv_perm(const vector<T>&ord){
  vector<T>inv(ord.size());
  for(int i=0;i<ord.size();i++)inv[ord[i]] = i;
  return inv;
}
ll FLOOR(ll n,ll div){assert(div>0);return n>=0?n/div:(n-div+1)/div;}
ll CEIL(ll n,ll div){assert(div>0);return n>=0?(n+div-1)/div:n/div;}
ll digitsum(ll n){ll ret=0;while(n){ret+=n%10;n/=10;}return ret;}
ll modulo(ll n,ll d){return (n%d+d)%d;};
template<typename T>T min(const vector<T>&v){return *min_element(v.begin(),v.end());}
template<typename T>T max(const vector<T>&v){return *max_element(v.begin(),v.end());}
template<typename T>T acc(const vector<T>&v){return accumulate(v.begin(),v.end(),T(0));};
template<typename T>T reverse(const T &v){return T(v.rbegin(),v.rend());};
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int popcount(ll x){return __builtin_popcountll(x);};
int poplow(ll x){return __builtin_ctzll(x);};
int pophigh(ll x){return 63 - __builtin_clzll(x);};
template<typename T>T poll(queue<T> &q){auto ret=q.front();q.pop();return ret;};
template<typename T>T poll(priority_queue<T> &q){auto ret=q.top();q.pop();return ret;};
template<typename T>T poll(QP<T> &q){auto ret=q.top();q.pop();return ret;};
template<typename T>T poll(stack<T> &s){auto ret=s.top();s.pop();return ret;};
ll MULT(ll x,ll y){if(LLONG_MAX/x<=y)return LLONG_MAX;return x*y;}
ll POW2(ll x, ll k){ll ret=1,mul=x;while(k){if(mul==LLONG_MAX)return LLONG_MAX;if(k&1)ret=MULT(ret,mul);mul=MULT(mul,mul);k>>=1;}return ret;}
ll POW(ll x, ll k){ll ret=1;for(int i=0;i<k;i++){if(LLONG_MAX/x<=ret)return LLONG_MAX;ret*=x;}return ret;}
template< typename T = int >
struct edge {
  int to;
  T cost;
  int id;
  edge():id(-1){};
  edge(int to, T cost = 1, int id = -1):to(to), cost(cost), id(id){}
  operator int() const { return to; }
};

template<typename T>
using Graph = vector<vector<edge<T>>>;
template<typename T>
Graph<T>revgraph(const Graph<T> &g){
  Graph<T>ret(g.size());
  for(int i=0;i<g.size();i++){
    for(auto e:g[i]){
      int to = e.to;
      e.to = i;
      ret[to].push_back(e);
    }
  }
  return ret;
}
template<typename T>
Graph<T> readGraph(int n,int m,int indexed=1,bool directed=false,bool weighted=false){
  Graph<T> ret(n);
  for(int es = 0; es < m; es++){
    int u,v;
    T w=1;
    cin>>u>>v;u-=indexed,v-=indexed;
    if(weighted)cin>>w;
    ret[u].emplace_back(v,w,es);
    if(!directed)ret[v].emplace_back(u,w,es);
  }
  return ret;
}
template<typename T>
Graph<T> readParent(int n,int indexed=1,bool directed=true){
  Graph<T>ret(n);
  for(int i=1;i<n;i++){
    int p;cin>>p;
    p-=indexed;
    ret[p].emplace_back(i);
    if(!directed)ret[i].emplace_back(p);
  }
  return ret;
}

template <typename F>
class
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
  [[nodiscard]]
#endif  // defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
FixPoint final : private F
{
public:
  template <typename G>
  explicit constexpr FixPoint(G&& g) noexcept
    : F{std::forward<G>(g)}
    {}

  template <typename... Args>
  constexpr decltype(auto)
  operator()(Args&&... args) const
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 9
  noexcept(noexcept(F::operator()(std::declval<FixPoint>(), std::declval<Args>()...)))
#endif  // !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 9
  {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};  // class FixPoint


#if defined(__cpp_deduction_guides)
template <typename F>
FixPoint(F&&)
  -> FixPoint<std::decay_t<F>>;
#endif  // defined(__cpp_deduction_guides)


namespace
{
  template <typename F>
#if !defined(__has_cpp_attribute) || !__has_cpp_attribute(nodiscard)
#  if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
  __attribute__((warn_unused_result))
#  elif defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_Check_return_)
  _Check_return_
#  endif  // defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#endif  // !defined(__has_cpp_attribute) || !__has_cpp_attribute(nodiscard)
  inline constexpr decltype(auto)
  makeFixPoint(F&& f) noexcept
{
  return FixPoint<std::decay_t<F>>{std::forward<std::decay_t<F>>(f)};
}
}  // namespace

using Real = long double;
using Point = complex<Real>;
const Real EPS = 1e-10, PI = acos((Real)(-1.0));

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }
inline bool eq(Point a, Point b) { return fabs(b - a) < EPS; }

Point operator*(const Point &p, const Real &d) {
  return Point(real(p) * d, imag(p) * d);
}

istream &operator>>(istream &is, Point &p) {
  Real a, b;
  is >> a >> b;
  p = Point(a, b);
  return is;
}

ostream &operator<<(ostream &os, Point &p) {
  return os << fixed << setprecision(10) << p.real() << " " << p.imag();
}

Point rotate(Real theta, const Point &p) {
  return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

namespace std {
  bool operator<(const Point& a, const Point& b) {
    return !eq(a.real(), b.real()) ? a.real() < b.real() : a.imag() < b.imag();
  }
}

struct Line {
  Point a, b;
  Line() = default;
  Line(Point a, Point b): a(a), b(b) {}

  friend ostream &operator<<(ostream &os, Line &p) {
    return os << p.a << " to " << p.b;
  }

  friend istream &operator>>(istream &is, Line &a) {
    return is >> a.a >> a.b;
  }
};

struct Circle {
  Point c;
  Real r;
  Circle() = default;
  Circle(Point c, Real r): c(c), r(r) {}

  friend ostream &operator<<(ostream &os, Circle &c) {
    return os << c.c << ": " << c.r;
  }

  friend istream &operator>>(istream &is, Circle &c) {
    return is >> c.c >> c.r;
  }
};

Real cross(const Point &a, const Point &b) {
  return real(a) * imag(b) - real(b) * imag(a);
}

Real dot(const Point &a, const Point &b) {
  return real(a) * real(b) + imag(a) * imag(b);
}

struct Segment : Line {
  Segment() = default;
  Segment(Point a, Point b) : Line(a, b) {}
};

int ccw(const Point &a, Point b, Point c) {
  b = b - a, c = c - a;
  if (cross(b, c) > EPS) return +1; // COUNTER_CLOCKWISE
  if (cross(b, c) < -EPS) return -1; // CLOCKWISE
  if (dot(b, c) < 0) return +2; // ONLINE_BACK
  if (norm(b) < norm(c)) return -2; // ONLINE_FRONT
  return 0; // ON_SEGMENT
}

bool intersect(const Segment &s, const Point &p) {
  return ccw(s.a, s.b, p) == 0;
}

bool intersect(const Segment &s, const Segment&t) {
  return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

bool intersect(const Line &l, const Segment& s) {
  return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS;
}

int intersect(const Circle &c, const Circle &d) {
  Real dis = fabs(c.c - d.c);

  if (dis > c.r + d.r + EPS) return 4;
  else if (eq(dis, c.r + d.r)) return 3;
  else if (eq(dis, abs(c.r - d.r))) return 1;
  else if (dis + min(c.r, d.r) < max(c.r, d.r) - EPS) return 0;
  else return 2;
}

bool parallel(const Line &a, const Line &b) {
  return abs(cross(a.b - a.a, b.b - b.a)) < EPS;
}

bool orthogonal(const Line &a, const Line &b) {
  return abs(dot(a.b - a.a, b.b - b.a)) < EPS;
}

Point projection(const Line& s, const Point &p) {
  double t = dot(p - s.a, s.b - s.a) / norm(s.b - s. a);
  return s.a + (s.b - s.a) * t;
}

Point projection(const Segment& l, const Point &p) {
  return projection(Line(l), p);
}

Point reflection(const Line &l, const Point &p) {
  Point r = projection(l, p);
  return p + (r - p) * 2;
}

Real distance(const Line &l, const Point &p) {
  Point r = projection(l, p);
  return fabs(p - r);
}

Real distance(const Segment&s, const Point &p) {
  Point r = projection(s, p);
  if (intersect(s, r)) return abs(r - p);
  return min(abs(s.a - p), abs(s.b - p));
}

Real distance(const Segment& a, const Segment& b) {
  if (intersect(a, b)) return 0;
  return min({
    distance(a, b.a),
    distance(a, b.b),
    distance(b, a.a),
    distance(b, a.b)
  });
}

Point crosspoint(const Line &l, const Line &m) {
  Real A = cross(l.b - l.a, m.b - m.a);
  Real B = cross(l.b - l.a, l.b - m.a);
  if (eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
  return m.a + (m.b - m.a) * B / A;
}

Point crosspoint(const Segment& l, const Segment& m) {
  return crosspoint(Line(l), Line(m));
}

Line bisector_of_angle(const Point& a, const Point& b, const Point& c) {
  Real d_ab = fabs(a - b);
  Real d_bc = fabs(b - c);
  Point c_ = b + (c - b) * d_ab / d_bc;

  return Line(b, (a + c_) * 0.5);
}

Line bisector(const Point& a, const Point& b) {
  Point c = (a + b) * 0.5;
  Point d = c + rotate(PI / 2, b - c);

  return Line(c, d);
}

int intersect(const Circle &c, const Line &l) {
  Real d = distance(l, c.c);

  if (d > c.r + EPS) return 0;
  if (eq(d, c.r)) return 1;
  return 2;
}

pair<Point, Point> crosspoint(const Circle& c, const Line& l) {
  Real d = distance(l, c.c);

  Point p = projection(l, c.c);
  if (intersect(c, l) == 1) return { p, p };

  Real d2 = sqrt(c.r * c.r - d * d);
  Point v = (l.a - l.b) * (1.0 / fabs(l.a - l.b));

  return { p + d2 * v, p - d2 * v };
}

pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
  Real d = fabs(c1.c - c2.c);
  Real x1 = (c1.r * c1.r + d * d - c2.r * c2.r) / 2 / d;
  Real y = sqrt(c1.r * c1.r - x1 * x1);

  Point base = (c2.c * x1 + c1.c * (d - x1)) * (1.0 / d);
  Point v = rotate(PI / 2, c1.c - base);
  v = v / fabs(v);

  return { base + v * y, base - v * y };
}

pair<Point, Point> tangent(const Circle &c, const Point &p) {
  Real d = fabs(c.c - p);
  Real d2 = sqrt(d * d - c.r * c.r);
  Real a = acos(d2 / d);


  Point q = c.c - p;
  q = q / fabs(q);

//  cout << d << " " << d2 << " " << a << " " << q << endl;
  return {
    p + rotate(a, q) * d2,
    p + rotate(-a, q) * d2
  };
}

vector<Segment> common_tangent(Circle c1, Circle c2) {
  int isect = intersect(c1, c2);
  Real d = fabs(c1.c - c2.c);
  Point v = (c2.c - c1.c) / d;

  vector<Segment> res;

  if (isect == 0) {
    return {};
  } else if (isect == 1) {
    auto [p1, p2] = crosspoint(c1, Line(c1.c, c2.c));
    if (eq(fabs(p2 - c2.c), c2.r)) swap(p1, p2);

    Point v = p1 + rotate(PI/2, c2.c - p1);
    return { Segment(p1, v) };
  } else if (isect == 2) {
  } else if (isect == 3) {
    auto [p1, p2] = crosspoint(c1, c2);
    res.emplace_back(p1, rotate(PI / 2, c1.c - p1) + p1);
  } else {
    Real a = d * c1.r / (c1.r + c2.r);
    Point p = c1.c + v * a;

    Real d1 = sqrt(a * a - c1.r * c1.r), d2 = sqrt(norm(p - c2.c) - c2.r * c2.r);
    Real theta = acos(d1 / a);

//    cout << d << endl;
//    cout << a << " " << d1 << " " << d2 << " " << theta << ": " << p << endl;

    Point e = (c1.c - p) * (1.0 / fabs(c1.c - p));
    Point e1 = rotate(theta, e), e2 = rotate(-theta, e);

    res.emplace_back(p + e1 * d1, p - e1 * d2);
    res.emplace_back(p + e2 * d1, p - e2 * d2);
  }

  if (eq(c1.r, c2.r)) {
    Point e = rotate(PI / 2, v);
    res.push_back(Segment(c1.c + e * c1.r, c2.c + e * c1.r));
    res.push_back(Segment(c1.c - e * c1.r, c2.c - e * c1.r));
    return res;
  }

  if (c1.r > c2.r) swap(c1, c2);

  v = c1.c - c2.c;
  Point p = v * (1.0 / (c2.r - c1.r)) * c2.r + c2.c;

  auto [q1, q2] = tangent(c1, p);
  res.emplace_back(q1, crosspoint(c2, Line(p, q1)).first);
  res.emplace_back(q2, crosspoint(c2, Line(p, q2)).first);

  return res;
}

using Polygon = vector<Point>;

istream& operator>>(istream& is, Polygon &p) {
  for (int i = 0; i < p.size(); i++) is >> p[i];
  return is;
}

ostream& operator<<(ostream& os, Polygon &p) {
  for (int i = 0; i < p.size(); i++) os << p[i];
  return os;
}

Real area(const Polygon& p) {
  Real res = 0;
  for (int i = 0; i < p.size(); i++) {
    res += cross(p[i], p[(i + 1) % p.size()]);
  }
  return abs(res)/2;
}

int contains(Polygon g,Point p){
  int n=g.size();
  bool x=false;
  for(int i=0;i<n;i++){
    Point a=g[i]-p,b=g[(i+1)%n]-p;
    if(fabs(cross(a,b)) < EPS and dot(a,b) < EPS) return 1;
    if(a.imag()>b.imag()) swap(a,b);
    if(a.imag() < EPS and EPS < b.imag() and cross(a,b) > EPS ) {
//      cout << a << " --- " << b << ": " << cross(a, b) << endl;
      x = !x;
    }
  }
  return (x?2:0);
}

Polygon convex_hull(Polygon Q) {
  sort(ALL(Q));

  Polygon upper({Q[0]}), lower({Q[0]});

  rep(i, 1, Q.size()) {
    while (upper.size() >= 2) {
      int _ccw = ccw(upper[upper.size() - 2], upper[upper.size() - 1], Q[i]);
      if (_ccw == 1) {
        upper.pop_back();
      } else {
        break;
      }
    }
    if (upper.size() <= 1) {
      upper.push_back(Q[i]);
    } else if (upper.size() > 1) {
      int _ccw = ccw(upper[upper.size() - 2], upper[upper.size() - 1], Q[i]);
      if (_ccw == -1 || _ccw == -2) {
        upper.push_back(Q[i]);
      }
    }
  }
  rep(i, 1, Q.size()) {
    while (lower.size() >= 2) {
      int _ccw = ccw(lower[lower.size() - 2], lower[lower.size() - 1], Q[i]);
      if (_ccw == -1) {
        lower.pop_back();
      } else {
        break;
      }
    }

    if (lower.size() <= 1) {
      lower.push_back(Q[i]);
    } else if (lower.size() > 1) {
      int _ccw = ccw(lower[lower.size() - 2], lower[lower.size() - 1], Q[i]);
      if (_ccw == 1 || _ccw == -2) {
        lower.push_back(Q[i]);
      }
    }
  }

  Polygon ret;

  rep(i, 0, lower.size()) {
    ret.push_back(lower[i]);
//    cout << lower[i] << endl;
  }

//  cout << " | " << endl;

  rrep(i, 0, upper.size()) {
    if (!eq(lower[0], upper[i]) && !eq(lower.back(), upper[i]))
      ret.push_back(upper[i]);
//    cout << upper[i] << endl;
  }

  int start = 0;

//  cout << ret.size() << endl;
  rep(i, 0, ret.size()) {
    if (ret[i].imag() < ret[start].imag() || (eq(ret[i].imag(), ret[start].imag()) && ret[i].real() < ret[start].real())) {
      start = i;
    }
  }

  cout << ret.size() << endl;
  rep(i, 0, ret.size()) {
    auto p = ret[(i + start) % ret.size()];
    cout << (int)p.real() << " " << (int)p.imag() << endl;
  }

  return ret;
}

Real closest_pair(vector<Point> &pts, int l, int r) {
  int m = (l + r) / 2;
  if (r - l <= 1) {
    return INF;
  } else if (r - l == 2) {
    if (imag(pts[l]) > imag(pts[l + 1])) swap(pts[l], pts[l + 1]);
    return fabs(pts[l] - pts[l + 1]);
  }

  Real mid = pts[m].real();
  Real d = min(closest_pair(pts, l, m), closest_pair(pts, m, r));

  inplace_merge(pts.begin() + l, pts.begin() + m, pts.begin() + r, [](const Point &a, const Point& b) {
    return a.imag() < b.imag();
  });

  vector<Point> ret;

  for (int i = l; i < r; i++) {
    if (fabs(pts[i].real() - mid) >= d) continue;

    for (int j = ret.size() - 1; j >= 0; j--) {
      if (fabs(imag(ret[j]) - imag(pts[i])) >= d) break;
      chmin(d, fabs(ret[j] - pts[i]));
    }

    ret.emplace_back(pts[i]);
  }

  return d;
}

int main() {
  cout << fixed << setprecision(5);

  int n;
  Real w;
  while (cin >> n >> w && n != 0)  {
    vector<Point> needle(n);
    vector<Real> h(n);
    rep(i, 0, n) {
      cin >> needle[i] >> h[i];
    }

    auto check = [&](Real r) {
//      cout << r << endl;
      Polygon rect(4);
      if (r <= w) {
        rect = Polygon({
          Point(r, r), Point(100 - r, r), Point(100 - r, 100 - r), Point(r, 100 - r)
        });
      } else {
        Real d = sqrt(r * r - (r - w) * (r - w));
        rect = Polygon({
          Point(d, d), Point(100 - d, d), Point(100 - d, 100 - d), Point(d, 100 - d)
        });
      }
      if (rect[0].real() > rect[1].real() + EPS) return false;
//      cout << "rect: " << rect[0] << " - " << rect[2] << endl;

      vector<Circle> cirs(n);
      rep(i, 0, n) {
        Real d;
        if (r <= h[i]) d = r;
        else d = sqrt(r * r - (r - h[i]) * (r - h[i]));

        cirs[i] = Circle(needle[i], d);
//        cout << "circle: " << needle[i] << " " << d << endl;
        bool out = true;
        rep(j, 0, 4) {
          if (fabs(cirs[i].c - rect[j]) > cirs[i].r - EPS) out = false;
        }
        if (out) return false;
      }

      vector<Point> cands({rect[0], rect[1], rect[2], rect[3]});
      rep(i, 0, n) {
        rep(j, i + 1, n) {
          if (!intersect(cirs[i], cirs[j])) continue;

          auto [p1, p2] = crosspoint(cirs[i], cirs[j]);
          cands.push_back(p1);
          if (!eq(p1, p2)) cands.push_back(p2);
        }
        rep(j, 0, 4) {
          Segment sg(rect[j], rect[(j + 1) % 4]);
          if (!intersect(cirs[i], sg)) continue;

          auto [p1, p2] = crosspoint(cirs[i], sg);
          cands.push_back(p1);
          if (!eq(p1, p2)) cands.push_back(p2);
        }
      }

      for (auto &p : cands) {
        if (!(rect[0].real() - EPS < p.real() && p.real() < real(rect[2]) + EPS&&
            imag(rect[0]) - EPS < imag(p) && imag(p) < imag(rect[2]) + EPS)) {
          continue;
        }

        bool ok = true;
        rep(i, 0, n) {
          if (fabs(p - cirs[i].c) < cirs[i].r - EPS) {
            ok = false;
            break;
          }
        }
        if (ok) return true;
      }

      return false;
    };

    Real l = 1, r = (50 * 50 + w * w) / 2 / w, m;
    rep(_, 0, 35) {
      m = (l + r) / 2;
      if (check(m)) l = m;
      else r = m;
    }
    cout << l << endl;
  }
}
accuracy: 1
time_ms: 650
memory_kb: 3840
final_rank: 10

code_snippet: #include<bits/stdc++.h> 
using namespace std;
using ll=long long int;
//using Int=__int128;
#define ALL(A) A.begin(),A.end()
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
template<typename T> constexpr int bitUP(T x,int a){return (x>>a)&1;}
//→　↓　←　↑ 
int dh[4]={0,1,0,-1}, dw[4]={1,0,-1,0};
//右上から時計回り
//int dh[8]={-1,0,1,1,1,0,-1,-1}, dw[8]={1,1,1,0,-1,-1,-1,0};
//long double EPS = 1e-6;
//long double PI = acos(-1);
//const ll INF=(1LL<<62);
const int MAX=(1<<30);
constexpr ll MOD=1000000000+7;
//constexpr ll MOD=998244353;


inline void bin101(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
}

using Graph=vector<vector<int>>;

template<typename T >
struct edge {
	int to;
	T cost;
	edge()=default;
	edge(int to, T cost) : to(to), cost(cost) {}

};
template<typename T>
using WeightGraph=vector<vector<edge<T>>>;

//要素数n 初期値x
template<typename T>
inline vector<T> vmake(size_t n,T x){
	return vector<T>(n,x);
}

//a,b,c,x data[a][b][c] 初期値x
template<typename... Args>
auto vmake(size_t n,Args... args){
	auto v=vmake(args...);
	return vector<decltype(v)>(n,move(v));
}
////////////////////////////
// マクロや型
////////////////////////////

using DD=long double;

const DD EPS=1e-9;
const DD INF=1e50;
const DD PI=acosl(-1.0);
#define EQ(a,b) (abs( (a) - (b) )<EPS) //a==b
#define LS(a,b) ( (a)+EPS<(b) ) //a<b
#define GR(a,b) ( (a)>(b)+EPS ) //a>b
#define LE(a,b) ( (a)<(b)+EPS ) //a<=b
#define GE(a,b) ( (a)>(b)-EPS ) //a>=b

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


//点
using Point=complex<DD>;
istream &operator>>(istream &is, Point &p) {
  DD x,y;
  is>>x>>y;
  p=Point(x,y);
  return is;
}

//点a→点bの線分
//aとbが等しい時、色々バグるから注意!
struct Segment{
    Point a,b;
    Segment()=default;
    Segment(Point a,Point b) :a(a),b(b){}
    Segment(DD ax,DD ay,DD bx,DD by):a(ax,ay),b(bx,by){}
    Segment(DD r,Point a) :a(a),b(a+polar((DD)1.0,r)){} 
};
using Line=Segment;

//円
struct Circle{
    Point p;
    DD r;
    Circle()=default;
    Circle(Point p,DD r):p(p),r(r){}
};

using Polygon=vector<Point>;

////////////////////////////
// 基本計算
////////////////////////////

//度→ラジアン
inline DD torad(const DD deg){return deg*PI/180;}
//ラジアン→度
inline DD todeg(const DD rad){return rad*180/PI;}
//内積 |a||b|cosθ
inline DD dot(const Point &a,const Point &b){return (conj(a)*b).X;}
//外積 |a||b|sinθ
inline DD cross(const Point &a,const Point &b){return (conj(a)*b).Y;}
//ベクトルpを反時計回りにtheta(ラジアン)回転
Point rotate(const Point &p,const DD theta){return p*Point(cos(theta),sin(theta));}

//余弦定理 cos(角度abc(ラジアン))を返す
//長さの対応に注意 ab:辺abの長さ
//verify:https://codeforces.com/gym/102056/problem/F
DD cosine_formula(const DD ab,const DD bc,const DD ca){
    return (ab*ab+bc*bc-ca*ca)/(2*ab*bc);
}

inline bool xy_sort(const Point &a,const Point &b){
    if(a.X+EPS<b.X) return true;
    if(EQ(a.X,b.X) && a.Y+EPS<b.Y) return true;
    return false;
}
inline bool yx_sort(const Point &a,const Point &b){
    if(a.Y+EPS<b.Y) return true;
    if(EQ(a.Y,b.Y) && a.X+EPS<b.X) return true;
    return false;
}
namespace std{
    inline bool operator<(const Point &a,const Point &b)noexcept{
        return xy_sort(a,b);
    }
}
//DDの比較関数
//map<DD,vector<pii>,DDcom>
struct DDcom{
    bool operator()(const DD a, const DD b) const noexcept {
        return a+EPS<b;
    }
};


////////////////////////////
// 平行や直交
////////////////////////////

bool isOrthogonal(const Point &a,const Point &b){
    return EQ(dot(a,b),0.0);
}
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool isOrthogonal(const Segment &s,const Segment &t){
    return EQ(dot(s.a-s.b,t.a-t.b),0.0);
}
bool isParallel(const Point &a,const Point &b){
    return EQ(cross(a,b),0.0);
}
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool isParallel(const Segment &s,const Segment &t){
    return EQ(cross(s.a-s.b,t.a-t.b),0);
}
//線分a→bに対して点cがどの位置にあるか
//反時計回り:1　時計回り:-1 直線上(a,b,c:-2 a,c,b:0 c,a,b:2)
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
//線分a→bの端点にcがあるなら0と判定されるはず
int ccw(const Point &a,Point b,Point c){
    if(EQ(abs(b-c),0) or EQ(abs(a-c),0)) return 0;
    b-=a;c-=a;
    if(cross(b,c)>EPS) return 1;
    if(cross(b,c)<-EPS) return -1;
    if(dot(b,c)<-EPS) return 2;
    if(LS(norm(b),norm(c))) return -2;
    return 0;
}

////////////////////////////
// 射影と反射
////////////////////////////

//射影
//直線lに点pから垂線を引いたときの交点
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
Point project(const Point &p,const Line &l){
    Point base=l.b-l.a;
    DD r=dot(p-l.a,base)/norm(base);
    return l.a+base*r;
}
//反射
//直線lに対して点pと対称な点
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
Point reflect(const Point &p,const Line &l){
    return p+(project(p,l)-p)*(DD)2.0;
}
//反射
//直線lに対して線分sと対称な線分(直線でも使える)
//verify:https://onlinejudge.u-aizu.ac.jp/solutions/problem/1171/review/6009447/bin101/C++17
Segment reflect(const Segment &s,const Line &l){
    return Segment(reflect(s.a,l) , reflect(s.b,l));
}

////////////////////////////
// 点との距離
////////////////////////////

//点と直線の距離
DD DistPL(const Point &p,const Line &l){
    return abs(cross(l.b-l.a,p-l.a))/abs(l.b-l.a);
}
//点と線分の距離
DD DistPS(const Point &p,const Segment &s){
    if( dot(s.b-s.a,p-s.a)<0.0 ) return abs(p-s.a);
    if( dot(s.a-s.b,p-s.b)<0.0 ) return abs(p-s.b);
    return DistPL(p,s);
}

////////////////////////////
// 線分と直線
////////////////////////////

//線分a-b,c-dは交差するか?
//接する場合も交差すると判定
//接する場合は交差しないとするなら<=を<に変換
bool intersect(const Point &a,const Point &b,const Point &c,const Point &d){
    return(ccw(a,b,c)*ccw(a,b,d)<=0 && ccw(c,d,a)*ccw(c,d,b)<=0);
}
//線分s,tは交差するか？
//接する場合も交差すると判定
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B&lang=ja
//接する場合は交差しないとするならintersectの<=を<に変換
bool intersect(const Segment &s,const Segment &t){
    return intersect(s.a,s.b,t.a,t.b);
}
// 2直線の交点
// 線分の場合はintersectをしてから使う
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C&lang=ja
Point crossPoint(const Line &s,const Line &t){
    Point base=t.b-t.a;
    DD d1=cross(base,t.a-s.a);
    DD d2=cross(base,s.b-s.a);
    if(EQ(d1,0) and EQ(d2,0)) return s.a; //同じ直線
    if(EQ(d2,0)) assert(false); //交点がない
    return s.a+d1/d2*(s.b-s.a);
}
//線分と線分の距離
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D&lang=ja
DD Dist(const Segment &s,const Segment &t){
    if(intersect(s,t)) return 0.0;
    return min(min(DistPS(t.a,s),DistPS(t.b,s)),min(DistPS(s.a,t),DistPS(s.b,t)) );
}
bool issame(const Line &l,const Line &m){
    if (GR(abs(cross(m.a - l.a, l.b - l.a)),0) ) return false;
    if (GR(abs(cross(m.b - l.a, l.b - l.a)),0) ) return false;
    return true;
}

////////////////////////////
// 円
////////////////////////////
//直線lと円Cの交点
//l.aにより近い方がindexが小さい
//veirfy:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
vector<Point> crossPointLC(const Line &l,const Circle &c){
    vector<Point> ret;
    if(GR(DistPL(c.p,l),c.r)) return ret; //交点がないとき、空ベクトルを返す
    Point pr=project(c.p,l);
    Point e=(l.b-l.a)/(abs(l.b-l.a));
    DD base=sqrt(c.r*c.r-norm(pr-c.p));
    ret.push_back(pr-e*base);
    ret.push_back(pr+e*base);
    if(EQ(DistPL(c.p,l),c.r)) ret.pop_back(); //接するとき
    return ret;
}
//線分sと円cの交点
//交点がないときは空ベクトルを返す
//線分の端が交わる場合も交点とみなす
//s.aにより近い方がindexが小さい
vector<Point> crossPointSC(const Segment &s,const Circle &c){
    vector<Point> ret;
    if(DistPS(c.p,s)>c.r+EPS) return ret;
    auto koho=crossPointLC(s,c);
    for(auto p:koho){
        if(ccw(s.a,s.b,p)==0 or EQ(abs(p-s.a),0) or EQ(abs(p-s.b),0)) ret.push_back(p);
    }
    return ret;
}

//円aと円bの共通接線の数
//離れている:4 外接:3 交わる:2 内接:1 内包:0
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A
int intersect(const Circle &a,const Circle &b){
    DD d=abs(a.p-b.p);
    if(GR(d,a.r+b.r)) return 4;
    if(EQ(d,a.r+b.r)) return 3;
    if(EQ(d,abs(a.r-b.r))) return 1;
    if(LS(d,abs(a.r-b.r))) return 0;
    return 2;
}

//円aと円bの交点
//交点がないときは空ベクトルを返す
//
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
vector<Point> crossPoint(const Circle &a,const Circle &b){
    vector<Point> ret;
    if(GR(abs(a.p-b.p),a.r+b.r)) return ret; //離れている
    DD d=abs(a.p-b.p);
    //cerr<<(a.r*a.r+d*d-b.r*b.r)/(2*a.r*d)<<endl;
    DD s=acosl((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d)); //0~π
    DD t=arg(b.p-a.p);
    if(EQ(a.r+b.r,d)) ret.push_back(a.p+polar(a.r,t));
    else ret.push_back(a.p+polar(a.r,t+s)),ret.push_back(a.p+polar(a.r,t-s));
    return ret;
}

//点pから円cに接線を引いたときの接点
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F&lang=ja
vector<Point> TanLine(const Point &p,const Circle &c){
    vector<Point> ret;
    DD d=abs(p-c.p);
    if(LS(d,c.r)) return ret; //pがcの内部にある場合
    if(EQ(d,c.r)){
        ret.push_back(p);
        return ret; //円の線上にある場合
    } 
    return crossPoint(c,Circle(p,sqrt(d*d-c.r*c.r)));
}

//円a,bの共通接線
//https://www.slideshare.net/kujira16/ss-35861169
//Line.aは円aと接線の交点
//(接線と円bの交点)と(接線と円aの交点)が違う場合はLine.bは(接線と円bの交点)
//一致する場合は円aの中心からLine.aに向かうベクトルを反時計回りに90度回転したものを
//Line.aに足したもの
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2201
vector<Line> TanLine(const Circle &a,const Circle &b){
    DD d=abs(a.p-b.p);
    vector<Line> ret;
    //外接線
    if(intersect(a,b)>=2){
        if(EQ(a.r,b.r)){
            Point up=polar(a.r,arg(b.p-a.p)+PI/2);
            ret.emplace_back(a.p+up,b.p+up);
            ret.emplace_back(a.p-up,b.p-up);
        }else{
            Point q=(a.p*b.r-b.p*a.r)/(b.r-a.r);
            auto as=TanLine(q,a);
            auto bs=TanLine(q,b);
            assert(as.size()==2 and bs.size()==2);
            for(int i=0;i<2;i++){
                ret.emplace_back(as[i],bs[i]);
            }
        }
    }else if(intersect(a,b)==1){ //内接する場合
        Point dir;
        if(a.r>b.r) dir=polar(a.r,arg(b.p-a.p));
        else dir=polar(a.r,arg(a.p-b.p));
        ret.emplace_back(a.p+dir,a.p+dir+rotate(dir,PI/2));
    }
    //内接線
    if(GR(abs(a.p-b.p),a.r+b.r)){ //円が離れている場合
        Point q=a.p+(b.p-a.p)*a.r/(a.r+b.r);
        auto as=TanLine(q,a);
        auto bs=TanLine(q,b);
        assert(as.size()==2 and bs.size()==2);
        for(int i=0;i<2;i++){
            ret.emplace_back(as[i],bs[i]);
        }
    }else if(EQ(d,a.r+b.r)){ //円が接している場合
        Point dir=polar(a.r,arg(b.p-a.p));
        ret.emplace_back(a.p+dir,a.p+dir+rotate(dir,PI/2));
    }
    return ret;
}
//２つの円の共通部分の面積
//参考: https://tjkendev.github.io/procon-library/python/geometry/circles_intersection_area.html
//verify: https://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=6005736#1
DD Area(const Circle &c1,const Circle &c2){
    DD cd=abs(c1.p-c2.p);
    if(LE(c1.r+c2.r,cd)) return 0; //円が離れている

    if(LE(cd,abs(c1.r-c2.r))) //片方の円が他方を包んでいる
        return min(c1.r,c2.r)*min(c1.r,c2.r)*PI;

    DD theta1=acosl(cosine_formula(c1.r,cd,c2.r));
    DD theta2=acosl(cosine_formula(c2.r,cd,c1.r));

    return c1.r*c1.r*theta1+c2.r*c2.r*theta2-c1.r*cd*sin(theta1);
}


////////////////////////////
// 三角形
////////////////////////////

//ヘロンの公式　三角形の面積を返す
//三角形が成立するか(平行ではないか)を忘れずに
DD Heron(const DD ad,const DD bd,const DD cd){
    DD s=(ad+bd+cd)/2;
    return sqrt(s*(s-ad)*(s-bd)*(s-cd));
}
//三角形の外接円
//isParallel()を使って三角形が成立するか(平行ではないか)を忘れずに
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_C
Circle CircumscribedCircle(const Point &a,const Point &b,const Point &c){
    Point bc=(b+c)/(DD)2.0;
    Line aa(bc,bc+rotate(c-b,PI/2));
    Point ab=(a+b)/(DD)2.0;
    Line cc(ab,ab+rotate(b-a,PI/2));
    Point p=crossPoint(aa,cc);
    return Circle(p,abs(a-p));
}
//三角形の内接円
//isParallel()を使って三角形が成立するか(平行ではないか)を忘れずに
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_B
Circle InCircle(const Point &a,const Point &b,const Point &c){
    Line aa(a,a+polar((DD)1.0,(arg(b-a)+arg(c-a))/(DD)2.0));
    Line bb(b,b+polar((DD)1.0,(arg(a-b)+arg(c-b))/(DD)2.0));
    Point p=crossPoint(aa,bb);
    return Circle(p,DistPL(p,Line(a,b)));
}

////////////////////////////
// 多角形
////////////////////////////

//点pが多角形gに対してどの位置にあるか
//中:2 辺上:1 外:0
//凸多角形である必要ない
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C
int contains(const Point &p,const vector<Point> &g){
    int n=(int)g.size();
    int x=false;
    for(int i=0;i<n;i++){
        Point a=g[i]-p,b=g[(i+1)%n]-p;
        if(EQ(cross(a,b),0) && dot(a,b)<EPS) return 1;
        if(a.Y>b.Y) swap(a,b);
        if(a.Y<EPS && EPS<b.Y && cross(a,b)>EPS) x=!x;
    }
    return (x?2:0);
}
//凸性判定
//多角形gは凸か？
//gは反時計回りでも時計回りでもいい
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B
bool isConvex(const vector<Point> &g){
    int n=(int)g.size();
    if(n<=3) return true;
    int flag=0;
    int t;
    for(int i=0;i<n;i++){
        Point a(g[(i+1)%n]-g[i]),b(g[(i+2)%n]-g[i]);
        if(cross(a,b)>EPS) t=1;
        else if(cross(a,b)<-EPS) t=-1;
        else continue;
        if(flag==-t) return false;
        flag=t;
    }
    return true;
}

//凸包　アンドリューのアルゴリズム
//O(NlogN)
//反時計回りの多角形を返す
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A
vector<Point> ConvexHull(vector<Point> s,const bool on_edge){
    int j;
    if(on_edge) j=-1;
    else j=1;
    int sz=(int)s.size();
    if(sz<3) return s;
    sort(s.begin(),s.end(),yx_sort);

    int n=0;
    vector<Point> res(2*sz);
    for(int i=0;i<sz;i++){
        while(n>=2 && cross(res[n-1]-res[n-2],s[i]-res[n-2])<EPS*j){
            n--;
        }
        res[n]=s[i];
        n++;
    }
    int t=n+1;
    for(int i=sz-2;i>=0;i--){
        while(n>=t && cross(res[n-1]-res[n-2],s[i]-res[n-2])<EPS*j){
            n--;
        }
        res[n]=s[i];
        n++;
    }
    res.resize(n-1);
    return res;
}

//多角形g(凸でなくてもいい)の符号付き面積
//反時計回りの多角形なら正の値を返す　時計回りなら負
//O(N)
//https://imagingsolution.net/math/calc_n_point_area/
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A
DD Area(const vector<Point> &g){
    DD ret=0.0;
    int n=(int)g.size();
    for(int i=0;i<n;i++){
        ret+=cross(g[i],g[(i+1)%n]);
    }
    return ret/2.0;
}

//凸多角形gを直線lで切断
//直線の左側(向きを考慮)にできる凸多角形を返す
//多角形gが反時計回りならば、反時計回りで返す(時計回りなら時計回り)
//直線上の頂点を含む線分の交点は含めてない
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C
vector<Point> ConvexCut(const vector<Point> &g,const Line &l){
    vector<Point> ret;
    int gz=(int)g.size();
    for(int i=0;i<gz;i++){
        Point now=g[i],next=g[(i+1)%gz];
        if(ccw(l.a,l.b,now)!=-1) ret.push_back(now);
        if(EQ(DistPL(now,l),0) or EQ(DistPL(next,l),0)) continue;
        if(ccw(l.a,l.b,now)*ccw(l.a,l.b,next)<0){
            ret.push_back(crossPoint(Line(now,next),l));
        }
    }
    return ret;
}
//部品
inline DD calc(const Point &a,const Point &b,const DD &r,const bool triangle){
    if(triangle) return cross(a,b);
    else return r*r*arg(b/a);
}
//部品
DD calcArea(const DD &r,const Point &a,const Point &b){
    if(EQ(abs(a-b),0)) return 0;
    bool ina=(abs(a)<r+EPS);
    bool inb=(abs(b)<r+EPS);
    if(ina && inb) return cross(a,b);
    auto cr=crossPointSC(Segment(a,b),Circle(Point(0,0),r));
    if(cr.empty()) return calc(a,b,r,false);
    auto s=cr[0],t=cr.back();
    return calc(s,t,r,true)+calc(a,s,r,ina)+calc(t,b,r,inb);
}
//円と多角形の共通部分の面積
//多角形が反時計回りならば正の値を返す
//凸多角形でなくても大丈夫
//http://drken1215.hatenablog.com/entry/2020/02/02/091000
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H&lang=ja
DD Area(const Circle &c,const vector<Point> &g){
    DD ret=0.0;
    int gz=g.size();
    if(gz<=2) return ret;
    for(int i=0;i<gz;i++){
        Point a=g[i]-c.p,b=g[(i+1)%gz]-c.p;
        ret+=calcArea(c.r,g[i]-c.p,g[(i+1)%gz]-c.p);
    }
    return ret/2.0;
}

//点と多角形の距離
//点が多角形の中にあるなら0
DD Dist(const Point &a,const vector<Point> &b){
	if(b.size()==1) return abs(a-b[0]);
	if(contains(a,b)>=1) return 0.0L;
	DD ret=INF;
	for(int i=0;i<b.size();i++){
		chmin(ret,DistPS(a,Segment(b[i],b[(i+1)%b.size()])));
	}
	return ret;
}

//多角形と多角形の距離
//どちらかが内側に入っていたら0
//全ての線分の組み合わせの距離を求めて、その最小が答え
//O(size(a)*size(b))
//sizeが1の時は点との距離になる
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2827
DD Dist(const vector<Point> &a,const vector<Point> &b){
	DD ret=INF;
	if(a.size()==1) return Dist(a[0],b);
	if(b.size()==1) return Dist(b[0],a);

	if(contains(a[0],b)>=1) return 0.0L;
	if(contains(b[0],a)>=1) return 0.0L;

	for(int i=0;i<a.size();i++){
		for(int j=0;j<b.size();j++){
			Segment sa(a[i],a[(i+1)%a.size()]);
			Segment sb(b[j],b[(j+1)%b.size()]);
			chmin(ret,Dist(sa,sb));
		}
	}
	return ret;
}

////////////////////////////
// 最近(遠)点間距離
////////////////////////////
//部品
DD RecClosetPair(const vector<Point>::iterator it,const int n){
    if(n<=1) return INF;
    int m=n/2;
    DD x=it[m].X;
    DD d=min(RecClosetPair(it,m),RecClosetPair(it+m,n-m));
    inplace_merge(it,it+m,it+n,yx_sort);
    vector<Point> v;
    for(int i=0;i<n;i++){
        if(abs(it[i].X-x)>=d) continue;
        for(int j=0;j<v.size();j++){
            DD dy=it[i].Y-v[(int)v.size()-1-j].Y;
            if(dy>=d) break;
            DD dx=it[i].X-v[(int)v.size()-1-j].X;
            d=min(d,sqrt(dx*dx+dy*dy));
        }
        v.push_back(it[i]);
    }
    return d;
}
//最近点対の距離
//点が1つのときINFを返す
//O(NlogN)
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
DD ClosetPair(vector<Point> g){
    sort(g.begin(),g.end(),xy_sort);
    return RecClosetPair(g.begin(),g.size());
}

//最遠頂点間
//verify:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
DD Diameter(vector<Point> g){
    g=ConvexHull(g,1);
    int gz=g.size();
    int m=0,M=0;
    for(int i=1;i<gz;i++){
        if(g[i].Y<g[m].Y) m=i;
        if(g[i].Y>g[M].Y) M=i;
    }
    DD ret=0;
    int sm=m,sM=M;
    while(m!=sM || M!=sm){
        ret=max(ret,norm(g[m]-g[M]));
        if(cross(g[(m+1)%gz]-g[m],g[(M+1)%gz]-g[M])<0) m=(m+1)%gz;
        else M=(M+1)%gz;
    }
    return sqrt(ret);
}
//動的凸包
//辺上にある点は含めない
//verify:https://atcoder.jp/contests/geocon2013/tasks/geocon2013_c
struct DynamicConvex{
	set<Point> up,down;
	DynamicConvex(){}
 
	bool isContain(set<Point> &pol,Point p){
		if(pol.size()==0) return false;
		if(pol.size()==1){
			Point q=*begin(pol);
			return EQ(q.X,p.X) and GE(q.Y,p.Y);
		}
		assert(pol.size()>=2);
        auto left=begin(pol);
        auto right=(--end(pol));
        if(LS(p.X,left->X) or GR(p.X,right->X)) return false;
        
        
        auto q1=pol.upper_bound(Point(p.X,INF));
        if(q1==end(pol)){
            return GE(right->Y,p.Y);
        }
        auto q2=q1--; //q1が範囲外になるのは最初に弾いてる
        return GE(cross(p-*q1,*q2-*q1),0.0);
	}
    bool isContain(Point p){
        if(not isContain(up,p)) return false;
        if(not isContain(down,Point(p.X,-p.Y))) return false;
        return true;
    }
 
	void add(set<Point> &pol,Point p){
		if(pol.size()==0){
			pol.insert(p);
			return;
		}
		if(pol.size()==1){
            Point q=*begin(pol);
			if(EQ(q.X,p.X)){
                pol.clear();
                pol.insert(max(p,q));
			}else{
				pol.insert(p);
			}
            return;
		}
        assert(pol.size()>=2);
        if(isContain(pol,p)) return;
        //left
        auto q1=pol.upper_bound(Point(p.X,INF));
        if(q1!=begin(pol)){
            q1--;
            while(pol.size()>=1 and q1!=begin(pol)){
                auto q2=q1--;
                if(GR(cross(*q2-p,*q1-p),0)) break;
                pol.erase(q2);
            }
        }
        //right
        q1=pol.lower_bound(Point(p.X,-INF));
        if(q1!=end(pol)){
            while(pol.size()>1 and q1!=--end(pol)){
                auto q2=q1++;
                if(GR(cross(*q1-p,*q2-p),0.0)) break;
                pol.erase(q2);
            }
        }
        pol.insert(p);
	}
 
	void add(Point p){
		add(up,p);
		add(down,Point(p.X,-p.Y)); //upと同じように処理をしたいから
	}
};

//垂直二等分線
//p-↑-q こんなかんじ
//voronoiで使う
Line bisector(const Point &p, const Point &q) {
    Point c=(p+q)/DD(2.0);
    Point v=rotate(q-p,PI/2);
    v/=abs(v);
    return Line(c-v,c+v);
}

//ボロノイ図
//pol:全体 ps:点の集合 id:中心となる点の添字 pp:中心となる点
//計算量: pol.size()*ps.size()
//verify: https://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=6005648#1
vector<Point> voronoi(Polygon pol,const vector<Point> &ps,int id=-1,const Point pp=Point()){
    Point p;
    if(id!=-1) p=ps[id];
    else p=pp;
    for(size_t i=0;i<ps.size();i++){
        if(i==id) continue;
        Line l=bisector(p,ps[i]);
        pol=ConvexCut(pol,l);
    }
    return pol;
}
int N,W;

bool OK(vector<Circle> C,Point p){
    for(auto c:C){
        if(LS(abs(p-c.p),c.r)) return false; 
    }

    return true;
}

void solve(){
while(true){
    cin>>N>>W;
    if(N==0) return;
    vector<DD> x(N),y(N),H(N);
    for(int i=0;i<N;i++) cin>>x[i]>>y[i]>>H[i];

    DD ok=0,ng=1e4;
    int T=100;
    while(T--){
        DD mid=(ok+ng)/2;

        vector<Point> koho;
        vector<Circle> C;
        for(int i=0;i<N;i++){
            DD r;
            if(mid>H[i]) r=mid*mid-(mid-H[i])*(mid-H[i]);
            else r=mid*mid;
            //if(LE(r,0)) continue;
            r=sqrtl(r);
            C.emplace_back(Point(x[i],y[i]),r);
        }
        DD w;
        if(mid>W) w=mid*mid-(mid-W)*(mid-W);
        else w=mid*mid;
        w=sqrtl(w);
        vector<Segment> S;

        S.emplace_back(Point(w,w),Point(w,100-w));
        S.emplace_back(Point(w,w),Point(100-w,w));
        S.emplace_back(Point(100-w,100-w),Point(w,100-w));
        S.emplace_back(Point(100-w,100-w),Point(100-w,w));
        for(size_t i=0;i<C.size();i++){
            for(size_t j=i+1;j<C.size();j++){
                int s=intersect(C[i],C[j]);
                if(s==0) continue;
                auto x=crossPoint(C[i],C[j]);
                for(auto y:x){
                    koho.push_back(y);
                }
            }
            for(auto s:S){
                auto v=crossPointSC(s,C[i]);
                for(auto y:v){
                    koho.push_back(y);
                }
            }
        }
        koho.emplace_back(w,w);
        koho.emplace_back(w,100-w);
        koho.emplace_back(100-w,w);
        koho.emplace_back(100-w,100-w);

        bool Ok=false;
        for(auto y:koho){
            if(GR(y.X,100-w)) continue;
            if(GR(y.Y,100-w)) continue;
            if(LS(y.X,w)) continue;
            if(LS(y.Y,w)) continue;
            if(OK(C,y)) Ok=true;
        }
        if(Ok) ok=mid;
        else ng=mid; 
    }
    cout<<ok<<endl;
}
}

int main(){
    bin101();
    int T=1;
    //cin>>T;
    while(T--) solve();
}
accuracy: 1
time_ms: 1280
memory_kb: 3900
final_rank: 14

code_snippet: /*	author:  Kite_kuma
	created: 2021.08.17 02:01:28 */

// #ifdef LOCAL
// #define _GLIBCXX_DEBUG
// #endif
#include <bits/stdc++.h>
using namespace std;

#pragma region macros

#define foa(s, v) for(auto &s : v)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcnt(n) __builtin_popcountll((long long)n)

#define REPname(a, b, c, d, e, ...) e
#define rep(...) REPname(__VA_ARGS__, REP3, REP2, REP1, REP0)(__VA_ARGS__)
#define REP0(x) for(int Counter_in_rep_macro = 0; Counter_in_rep_macro < (x); ++Counter_in_rep_macro)
#define REP1(i, x) for(int i = 0; i < (x); ++i)
#define REP2(i, l, r) for(int i = (l); i < (r); ++i)
#define REP3(i, l, r, c) for(int i = (l); i < (r); i += (c))

#define DREPname(a, b, c, d, e, ...) e
#define drep(...) DREPname(__VA_ARGS__, DREP3, DREP2, DREP1)(__VA_ARGS__)
#define DREP1(i, x) for(int i = (x)-1; i >= 0; --i)
#define DREP2(i, l, r) for(int i = (r)-1; i >= (l); --i)
#define DREP3(i, l, r, c) for(int i = (r)-1; i >= (l); i -= (c))

#pragma endregion

#pragma region aliases

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vvvi = std::vector<std::vector<std::vector<int>>>;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
template <class T = ll>
using V = std::vector<T>;
template <class T = ll>
using VV = V<V<T>>;
template <class T = ll>
using VVV = V<V<V<T>>>;
template <class T = ll>
using pqup = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T = ll>
using pqdn = std::priority_queue<T>;

#pragma endregion

#pragma region constants

const int inf = 1e9;
const long long INF = 1e18;
const long double pi = acos(-1);
const char dl = '\n';
const char sp = ' ';
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

const int mod_1000000007 = 1000000007;
const int mod_998244353 = 998244353;

#pragma endregion

#pragma region basic_operation

template <class T0, class T1, class T2>
inline bool in_range(T0 x, T1 lef, T2 rig) {
	return ((lef <= x) && (x < rig));
}

template <class T>
inline bool chmin(T &a, T b) {
	if(a > b) {
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b) {
	if(a < b) {
		a = b;
		return true;
	}
	return false;
}

void Yes(bool f = 1) { std::cout << (f ? "Yes" : "No") << '\n'; }
void No() { std::cout << "No\n"; }
void YES(bool f = 1) { std::cout << (f ? "YES" : "NO") << '\n'; }
void NO() { std::cout << "NO\n"; }

template <class T>
void drop(T answer) {
	std::cout << answer << '\n';
	exit(0);
}

void err(bool flag = true) {
	if(!flag) return;
	std::cout << -1 << '\n';
	exit(0);
}

template <class T>
void vout(std::vector<T> const &v, bool vertically = 0) {
	if(vertically) {
		for(auto const &a : v) {
			std::cout << a << '\n';
		}
		return;
	}
	for(auto it = v.begin(); it != v.end(); it++) {
		std::cout << (*it);
		if(it != v.end() - 1) {
			std::cout << ' ';
		}
	}
	std::cout << '\n';
	return;
}

inline void print() { std::cout << '\n'; }
template <class T>
inline void print(T x) {
	std::cout << x << '\n';
	return;
}
template <typename Head, typename... Tail>
void print(Head H, Tail... T) {
	std::cout << H << " ";
	print(T...);
}

template <class T>
void add(std::vector<T> &v, T val) {
	for(auto &a : v) a += val;
	return;
}

template <class T>
T dup(T a, T b) {
	assert(b != 0);
	return (a + b - 1) / b;
}

template <class T>
T greatest_lower_multiple(T x, T d) {
	if(d == 0) return 0;
	if(d < 0) d *= -1;
	T y = x % d;
	if(y < 0) y += d;
	return x - y;
}

template <class T>
T least_upper_multiple(T x, T d) {
	return -greatest_lower_multiple(-x, d);
}

long long POW(long long a, long long n) {
	long long res = 1;
	while(n > 0) {
		if(n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

long long modpow(long long a, long long n, long long mod) {	 // a^n mod
	assert(n >= 0 && mod);
	if(mod == 1) return 0LL;
	long long res = 1;
	a %= mod;
	while(n > 0) {
		if(n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res < 0 ? res + mod : res;
}

// return x which satisfies a * x % mod == gcd(a, mod)
// not (mod | a)
long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while(b) {
		long long t = a / b;
		a -= t * b;
		std::swap(a, b);
		u -= t * v;
		std::swap(u, v);
	}
	u %= mod;
	if(u < 0) u += mod;
	return u;
}

template <class T>
int lb(const std::vector<T> &a, const T x) {
	return std::distance(a.begin(), std::lower_bound(a.begin(), a.end(), x));
}
template <class T>
int ub(const std::vector<T> &a, const T x) {
	return std::distance(a.begin(), std::upper_bound(a.begin(), a.end(), x));
}
template <class T>
void unq_sort(std::vector<T> &a) {
	std::sort(a.begin(), a.end());
	a.erase(std::unique(a.begin(), a.end()), a.end());
}
template <class T>
std::vector<int> press(std::vector<T> &a) {
	auto vec = a;
	unq_sort(vec);
	std::vector<int> ret;
	for(auto &v : a) ret.push_back(lb(vec, v));
	return ret;
}

#pragma endregion

#pragma region input
#define VEC(type, name, size) \
	vector<type> name(size);  \
	scanner::INPUT(name)
#define VVEC(type, name, h, w)                     \
	vector<vector<type>> name(h, vector<type>(w)); \
	scanner::INPUT(name)
#define INT(...)     \
	int __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define LL(...)            \
	long long __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define STR(...)        \
	string __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define CHR(...)      \
	char __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define DBL(...)        \
	double __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define LD(...)              \
	long double __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define TPL3(type0, type1, type2, name)   \
	std::tuple<type0, type1, type2> name; \
	scanner::INPUT(name);
#define TPL4(type0, type1, type2, type3, name)   \
	std::tuple<type0, type1, type2, type3> name; \
	scanner::INPUT(name);

namespace scanner {
template <class T>
void scan(T &a) {
	std::cin >> a;
}

template <class T, class L>
void scan(std::pair<T, L> &p) {
	scan(p.first);
	scan(p.second);
}

template <class T0, class T1, class T2>
void scan(std::tuple<T0, T1, T2> &p) {
	T0 t0;
	T1 t1;
	T2 t2;
	scan(t0);
	scan(t1);
	scan(t2);
	p = std::make_tuple(t0, t1, t2);
}

template <class T0, class T1, class T2, class T3>
void scan(std::tuple<T0, T1, T2, T3> &p) {
	T0 t0;
	T1 t1;
	T2 t2;
	T3 t3;
	scan(t0);
	scan(t1);
	scan(t2);
	scan(t3);
	p = std::make_tuple(t0, t1, t2, t3);
}

template <class T>
void scan(std::vector<T> &a) {
	for(auto &i : a) scan(i);
}

void INPUT() {}
template <class Head, class... Tail>
void INPUT(Head &head, Tail &... tail) {
	scan(head);
	INPUT(tail...);
}
}  // namespace scanner

template <typename T1, typename T2>
std::istream &operator>>(std::istream &is, std::pair<T1, T2> &p) {
	is >> p.first >> p.second;
	return is;
}
#pragma endregion

#pragma region debug

#pragma region output
template <typename T1, typename T2>
std::ostream &std::operator<<(std::ostream &os, const std::pair<T1, T2> &p) {
	os << p.first << " " << p.second;
	return os;
}
template <class T>
std::ostream &std::operator<<(std::ostream &os, const std::vector<T> &v) {
	for(int i = 0; i < (int)v.size(); i++) {
		if(i) os << " ";
		os << v[i];
	}
	return os;
}
#pragma endregion

#pragma region view

namespace viewer {
void view(const long long e) {
	if(e == INF)
		std::cerr << "INF";
	else if(e == -INF)
		std::cerr << "-INF";
	else
		std::cerr << e;
}

void view(const int e) {
	if(e == inf)
		std::cerr << "inf";
	else if(e == -inf)
		std::cerr << "-inf";
	else
		std::cerr << e;
}

template <typename T>
void view(const T e) {
	std::cerr << e;
}

template <typename T, typename U>
void view(const std::pair<T, U> &p) {
	std::cerr << "(";
	view(p.first);
	std::cerr << ", ";
	view(p.second);
	std::cerr << ")";
}

template <class T0, class T1, class T2>
void view(const std::tuple<T0, T1, T2> &p) {
	std::cerr << "(";
	view(std::get<0>(p));
	std::cerr << ", ";
	view(std::get<1>(p));
	std::cerr << ", ";
	view(std::get<2>(p));
	std::cerr << ")";
}

template <class T0, class T1, class T2, class T3>
void view(const std::tuple<T0, T1, T2, T3> &p) {
	std::cerr << "(";
	view(std::get<0>(p));
	std::cerr << ", ";
	view(std::get<1>(p));
	std::cerr << ", ";
	view(std::get<2>(p));
	std::cerr << ", ";
	view(std::get<3>(p));
	std::cerr << ")";
}

template <typename T>
void view(const std::set<T> &s) {
	if(s.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(auto &t : s) {
		view(t);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::unordered_set<T> &s) {
	if(s.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(auto &t : s) {
		view(t);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::vector<T> &v) {
	if(v.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(const auto &e : v) {
		view(e);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::vector<std::vector<T>> &vv) {
	std::cerr << "{\n";
	for(const auto &v : vv) {
		std::cerr << "\t";
		view(v);
		std::cerr << '\n';
	}
	std::cerr << "}";
}

template <typename T, typename U>
void view(const std::vector<std::pair<T, U>> &v) {
	std::cerr << "{\n";
	for(const auto &c : v) {
		std::cerr << "\t(";
		view(c.first);
		std::cerr << ", ";
		view(c.second);
		std::cerr << ")\n";
	}
	std::cerr << "}";
}

template <class T0, class T1, class T2>
void view(const std::vector<std::tuple<T0, T1, T2>> &v) {
	if(v.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << '{';
	for(const auto &t : v) {
		std::cerr << "\n\t";
		view(t);
		std::cerr << ",";
	}
	std::cerr << "\n}";
}

template <class T0, class T1, class T2, class T3>
void view(const std::vector<std::tuple<T0, T1, T2, T3>> &v) {
	if(v.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << '{';
	for(const auto &t : v) {
		std::cerr << "\n\t";
		view(t);
		std::cerr << ",";
	}
	std::cerr << "\n}";
}

template <typename T, typename U>
void view(const std::map<T, U> &m) {
	std::cerr << "{\n";
	for(const auto &t : m) {
		std::cerr << "\t[";
		view(t.first);
		std::cerr << "] : ";
		view(t.second);
		std::cerr << '\n';
	}
	std::cerr << "}";
}

template <typename T, typename U>
void view(const std::unordered_map<T, U> &m) {
	std::cerr << "{\n";
	for(const auto &t : m) {
		std::cerr << "\t[";
		view(t.first);
		std::cerr << "] : ";
		view(t.second);
		std::cerr << '\n';
	}
	std::cerr << "}";
}
}  // namespace viewer

#pragma endregion

// when debugging : g++ foo.cpp -DLOCAL
#ifdef LOCAL
void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	viewer::view(H);
	std::cerr << ", ";
	debug_out(T...);
}
#define debug(...)                                                \
	do {                                                          \
		std::cerr << __LINE__ << " [" << #__VA_ARGS__ << "] : ["; \
		debug_out(__VA_ARGS__);                                   \
		std::cerr << "\b\b]\n";                                   \
	} while(0)
#define dump(x)                                      \
	do {                                             \
		std::cerr << __LINE__ << " " << #x << " : "; \
		viewer::view(x);                             \
		std::cerr << '\n';                           \
	} while(0)

#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

#pragma endregion

#pragma region geometry

using Real = long double;
using Point = complex<Real>;
using Vec = Point;
const Real EPS = 1e-10, PI = acos(-1);

inline bool eq(const Real &a, const Real &b) { return fabs(b - a) < EPS; }
inline bool eq(const Point &a, const Point &b) { return fabs(b - a) < EPS; }
/*
	-1: a < b
	0 : a == b
	1 : a > b
*/
inline int compare(const Real &a, const Real &b) { return eq(a, b) ? 0 : a < b ? -1 : 1; }

const Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// rotate point 'p' for counter clockwise direction
const Point rotate(const Real &theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

const Real radian_to_degree(const Real &r) { return (r * 180.0 / PI); }

const Real degree_to_radian(const Real &d) { return (d * PI / 180.0); }

// get angle a-b-c (<pi)
const Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), w(c - b);
	Real theta = fabs(atan2(w.imag(), w.real()) - atan2(v.imag(), v.real()));
	return min(theta, 2 * PI - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " -- " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

const Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
const Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
const int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;		// "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;		// "CLOCKWISE"
	if(dot(b, c) < -EPS) return +2;			// "ONLINE_BACK"
	if(norm(b) + EPS < norm(c)) return -2;	// "ONLINE_FRONT"
	return 0;								// "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
Point reflection(const Line &l, const Point &p) { return projection(l, p) * 2.0 - p; }

int intersect(const Line &l, const Point &p) { return int(abs(ccw(l.a, l.b, p)) != 1); }

int intersect(const Line &l, const Line &m) {
	if(intersect(l, m.a) && intersect(l, m.b)) return -1;
	return int(abs(cross(l.b - l.a, m.b - m.a)) > EPS);
}

int intersect(const Segment &s, const Point &p) { return int(ccw(s.a, s.b, p) == 0); }

int intersect(const Line &l, const Segment &s) {
	if(intersect(l, s.a) && intersect(l, s.b)) return -1;
	return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS;
}

Real distance(const Line &l, const Point &p);

int intersect(const Circle &c, const Line &l) {
	Real d = c.r - distance(l, c.p);
	return fabs(d) < EPS ? 1 : d > 0. ? 2 : 0;
}

int intersect(const Circle &c, const Point &p) { return int(abs(abs(p - c.p) - c.r) < EPS); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
int intersect(const Segment &s, const Segment &t) {
	if(eq(s.a, s.b)) return intersect(t, s.a);
	if(intersect(Line(s), t.a) && intersect(Line(s), t.b) &&
	   std::max(std::min(s.a, s.b), std::min(t.a, t.b)) < std::min(std::max(s.a, s.b), std::max(t.a, t.b)))
		return -1;
	return int(ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0);
}

int intersect(const Circle &c, const Segment &l) {
	const Point h = projection(l, c.p);
	if(norm(h - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(compare(d1, c.r) == -1 && compare(d2, c.r) == -1) return 0;
	if(d1 < c.r - EPS && d2 > c.r - EPS || d1 > c.r - EPS && d2 < c.r - EPS) return 1;
	return dot(l.a - h, l.b - h) < 0 ? 2 : 0;
}

Real distance(const Point &a, const Point &b);

int number_of_common_tangents(const Circle &c1, const Circle &c2) {
	Real r1 = min(c1.r, c2.r), r2 = max(c1.r, c2.r), d = distance(c1.p, c2.p);
	int com = compare(r1 + r2, d);
	return com == 1 ? compare(d + r1, r2) + 1 : 3 - com;
	// if(c1.r < c2.r) swap(c1, c2);
	// Real d = abs(c1.p - c2.p);
	// if(compare(c1.r + c2.r, d) == -1) return 4;
	// if(eq(c1.r + c2.r, d)) return 3;
	// if(compare(c1.r - c2.r, d) == -1) return 2;
	// return int(eq(c1.r - c2.r, d));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(const Circle &c1, const Circle &c2) { return 2 - abs(2 - number_of_common_tangents(c1, c2)); }

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	return intersect(s, r) ? distance(r, p) : min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	Vec v = (l.b - l.a) / abs(l.b - l.a) * sqrt(c.r * c.r - norm(pr - c.p));
	return make_pair(pr - v, pr + v);
	// Vec e = (l.b - l.a) / abs(l.b - l.a);
	// double base = sqrt(c.r * c.r - norm(pr - c.p));
	// return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	if(intersect(c, l) == 2) return crosspoint(c, Line(l.a, l.b));
	auto ret = crosspoint(c, Line(l.a, l.b));
	if(dot(l.a - ret.first, l.b - ret.first) < EPS)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // cosine theorem
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return make_pair(p1, p2);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Vec u = (c2.p - c1.p) / sqrt(g);
	Vec v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H
// 円と多角形の共通部分の面積
Real area(const Polygon &p, const Circle &c) {
	if(p.size() < 3) return 0.0;
	function<Real(Circle, Point, Point)> cross_area = [&](const Circle &c, const Point &a, const Point &b) {
		Point va = c.p - a, vb = c.p - b;
		Real f = cross(va, vb), ret = 0.0;
		if(eq(f, 0.0)) return ret;
		if(max(abs(va), abs(vb)) < c.r + EPS) return f;
		if(distance(Segment(a, b), c.p) > c.r - EPS) return c.r * c.r * arg(vb * conj(va));
		auto u = crosspoint(c, Segment(a, b));
		vector<Point> tot{a, u.first, u.second, b};
		for(int i = 0; i + 1 < tot.size(); i++) {
			ret += cross_area(c, tot[i], tot[i + 1]);
		}
		return ret;
	};
	Real A = 0;
	for(int i = 0; i < p.size(); i++) {
		A += cross_area(c, p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
// 凸多角形の直径(最遠頂点対間距離)
Real convex_diameter(const Polygon &p) {
	int N = (int)p.size();
	int is = 0, js = 0;
	for(int i = 1; i < N; i++) {
		if(p[i].imag() > p[is].imag()) is = i;
		if(p[i].imag() < p[js].imag()) js = i;
	}
	Real maxdis = norm(p[is] - p[js]);

	int maxi, maxj, i, j;
	i = maxi = is;
	j = maxj = js;
	do {
		if(cross(p[(i + 1) % N] - p[i], p[(j + 1) % N] - p[j]) >= 0) {
			j = (j + 1) % N;
		} else {
			i = (i + 1) % N;
		}
		if(norm(p[i] - p[j]) > maxdis) {
			maxdis = norm(p[i] - p[j]);
			maxi = i;
			maxj = j;
		}
	} while(i != is || j != js);
	return sqrt(maxdis);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
// 最近点対
Real closest_pair(Points ps) {
	if(ps.size() <= 1) throw(0);
	sort(begin(ps), end(ps));  // xでソート

	auto compare_y = [&](const Point &a, const Point &b) { return imag(a) < imag(b); };
	vector<Point> beet(ps.size());
	const Real INF = 1e18;

	function<Real(int, int)> rec = [&](int left, int right) {
		if(right - left <= 1) return INF;
		int mid = (left + right) >> 1;
		auto x = real(ps[mid]);	 // 領域内でx座標真中の点
		auto ret = min(rec(left, mid), rec(mid, right));
		// y座標でソートされた2つの区間をマージ
		inplace_merge(begin(ps) + left, begin(ps) + mid, begin(ps) + right, compare_y);
		int ptr = 0;
		for(int i = left; i < right; i++) {
			if(abs(real(ps[i]) - x) >= ret) continue;
			for(int j = 0; j < ptr; j++) {
				auto luz = ps[i] - beet[ptr - j - 1];
				if(imag(luz) >= ret) break;
				ret = min(ret, abs(luz));
			}
			beet[ptr++] = ps[i];
		}
		return ret;
	};
	return rec(0, (int)ps.size());
}

// (aからの距離):(bからの距離) = dist_a : dist_b となる点の集合(円)を返す
Circle Apollonius_Circle(Point a, Point b, Real dist_a, Real dist_b) {
	assert(!eq(dist_a, dist_b));  //同じ場合はbisectionで
	Real asq = dist_a * dist_a, bsq = dist_b * dist_b;
	Point p = (a * bsq - b * asq) * (1 / (bsq - asq));
	Real r = abs(a - b) * dist_a * dist_b / abs(asq - bsq);
	return Circle(p, r);
}

// bisection of angle A-B-C
// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_B/judge/5763316/C++17
Line bisection_of_angle(const Point &a, const Point &b, const Point &c) {
	Real da = distance(a, b);
	Real dc = distance(b, c);
	return Line(b, (a * dc + c * da) / (da + dc));
}

// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_B/judge/5763316/C++17
Circle incircle_of_triangle(const Point &a, const Point &b, const Point &c) {
	Point center = crosspoint(bisection_of_angle(a, b, c), bisection_of_angle(b, c, a));
	return Circle(center, distance(Line(a, b), center));
}
Circle incircle_of_triangle(const Polygon &p) { return incircle_of_triangle(p[0], p[1], p[2]); }

// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_C/judge/5763330/C++17
Line bisection_of_points(const Point &a, const Point &b) {
	Point c = (a + b) * 0.5;
	return Line(c, c + rotate(PI / 2, b - a));
}

// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_C/judge/5763330/C++17
Circle circumscribed_circle_of_triangle(const Point &a, const Point &b, const Point &c) {
	Point center = crosspoint(bisection_of_points(a, b), bisection_of_points(b, c));
	return Circle(center, distance(a, center));
}
Circle circumscribed_circle_of_triangle(const Polygon &p) { return circumscribed_circle_of_triangle(p[0], p[1], p[2]); }

#pragma endregion

using R = Real;
R solve() {
	int n;
	cin >> n;
	if(n == 0) exit(0);
	R w;
	cin >> w;

	Points needles_place;
	V<R> needles_height;
	rep(n) {
		Real x, y, h;
		cin >> x >> y >> h;
		needles_place.emplace_back(x, y);
		needles_height.push_back(h);
	}

	auto min_dist = [&](R radius, R hieght) -> R {
		if(radius < hieght) return radius;
		return R(sqrt(radius * radius - (radius - hieght) * (radius - hieght)));
	};

	Lines walls;
	walls.emplace_back(Point(0, 0), Point(0, 100));
	walls.emplace_back(Point(100, 100), Point(0, 100));
	walls.emplace_back(Point(0, 0), Point(100, 0));
	walls.emplace_back(Point(100, 100), Point(100, 0));

	Lines internal;
	Circles cs(n);

	Points crs;

	auto safe = [&](const Point &center, const R &radius) {
		if(isnan(center.real())) return false;
		if(isnan(center.imag())) return false;

		if(compare(center.real(), 0) == -1 || compare(center.real(), 100) == 1 || compare(center.imag(), 0) == -1 ||
		   compare(center.imag(), 100) == 1) {
			// if(radius > 1. && radius < 3) debug(center, radius);
			return false;
		}

		rep(i, n) {
			if(compare(min_dist(radius, needles_height[i]), distance(center, needles_place[i])) == 1) return false;
		}

		R min_dist_wall = min_dist(radius, w);
		foa(wall, walls) {
			if(compare(min_dist_wall, distance(wall, center)) == 1) return false;
		}
		return true;
	};

	auto f = [&](R radius) {
		internal.clear();
		crs.clear();
		R min_dist_wall = min_dist(radius, w);
		internal.emplace_back(Point(min_dist_wall, 0), Point(min_dist_wall, 100));
		internal.emplace_back(Point(100, 100 - min_dist_wall), Point(0, 100 - min_dist_wall));
		internal.emplace_back(Point(0, min_dist_wall), Point(100, min_dist_wall));
		internal.emplace_back(Point(100 - min_dist_wall, 100), Point(100 - min_dist_wall, 0));

		rep(i, n) { cs[i] = Circle(needles_place[i], min_dist(radius, needles_height[i])); }

		foa(ln, internal) {
			foa(ln2, internal) {
				if(intersect(ln, ln2)) crs.push_back(crosspoint(ln, ln2));
			}

			foa(c, cs) {
				if(intersect(c, ln)) {
					auto ps = crosspoint(c, ln);
					crs.push_back(ps.first);
					crs.push_back(ps.second);
				}
			}
		}

		foa(c, cs) {
			foa(d, cs) {
				if(intersect(c, d) > 0) {
					auto ps = crosspoint(c, d);
					crs.push_back(ps.first);
					crs.push_back(ps.second);
				}
			}
		}

		foa(pt, crs) {
			if(isnan(pt.real())) continue;
			if(safe(pt, radius)) {
				if(radius > 10000000000000.) debug(pt, radius);
				return true;
			}
		}
		return false;
	};

	R ok = 0.;
	R ng = 130;
	rep(30) {
		R med = (ok + ng) / 2;
		if(f(med)) {
			ok = med;
		} else {
			ng = med;
		}
	}
	return ok;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout << std::fixed << std::setprecision(15);
	srand((unsigned)time(NULL));

	while(1) cout << solve() << dl;

	return 0;
}
accuracy: 1
time_ms: 800
memory_kb: 3928
final_rank: 13

code_snippet: /*	author:  Kite_kuma
	created: 2021.08.17 02:01:28 */

// #ifdef LOCAL
// #define _GLIBCXX_DEBUG
// #endif
#include <bits/stdc++.h>
using namespace std;

#pragma region macros

#define foa(s, v) for(auto &s : v)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcnt(n) __builtin_popcountll((long long)n)

#define REPname(a, b, c, d, e, ...) e
#define rep(...) REPname(__VA_ARGS__, REP3, REP2, REP1, REP0)(__VA_ARGS__)
#define REP0(x) for(int Counter_in_rep_macro = 0; Counter_in_rep_macro < (x); ++Counter_in_rep_macro)
#define REP1(i, x) for(int i = 0; i < (x); ++i)
#define REP2(i, l, r) for(int i = (l); i < (r); ++i)
#define REP3(i, l, r, c) for(int i = (l); i < (r); i += (c))

#define DREPname(a, b, c, d, e, ...) e
#define drep(...) DREPname(__VA_ARGS__, DREP3, DREP2, DREP1)(__VA_ARGS__)
#define DREP1(i, x) for(int i = (x)-1; i >= 0; --i)
#define DREP2(i, l, r) for(int i = (r)-1; i >= (l); --i)
#define DREP3(i, l, r, c) for(int i = (r)-1; i >= (l); i -= (c))

#pragma endregion

#pragma region aliases

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vvvi = std::vector<std::vector<std::vector<int>>>;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
template <class T = ll>
using V = std::vector<T>;
template <class T = ll>
using VV = V<V<T>>;
template <class T = ll>
using VVV = V<V<V<T>>>;
template <class T = ll>
using pqup = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T = ll>
using pqdn = std::priority_queue<T>;

#pragma endregion

#pragma region constants

const int inf = 1e9;
const long long INF = 1e18;
const long double pi = acos(-1);
const char dl = '\n';
const char sp = ' ';
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

const int mod_1000000007 = 1000000007;
const int mod_998244353 = 998244353;

#pragma endregion

#pragma region basic_operation

template <class T0, class T1, class T2>
inline bool in_range(T0 x, T1 lef, T2 rig) {
	return ((lef <= x) && (x < rig));
}

template <class T>
inline bool chmin(T &a, T b) {
	if(a > b) {
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b) {
	if(a < b) {
		a = b;
		return true;
	}
	return false;
}

void Yes(bool f = 1) { std::cout << (f ? "Yes" : "No") << '\n'; }
void No() { std::cout << "No\n"; }
void YES(bool f = 1) { std::cout << (f ? "YES" : "NO") << '\n'; }
void NO() { std::cout << "NO\n"; }

template <class T>
void drop(T answer) {
	std::cout << answer << '\n';
	exit(0);
}

void err(bool flag = true) {
	if(!flag) return;
	std::cout << -1 << '\n';
	exit(0);
}

template <class T>
void vout(std::vector<T> const &v, bool vertically = 0) {
	if(vertically) {
		for(auto const &a : v) {
			std::cout << a << '\n';
		}
		return;
	}
	for(auto it = v.begin(); it != v.end(); it++) {
		std::cout << (*it);
		if(it != v.end() - 1) {
			std::cout << ' ';
		}
	}
	std::cout << '\n';
	return;
}

inline void print() { std::cout << '\n'; }
template <class T>
inline void print(T x) {
	std::cout << x << '\n';
	return;
}
template <typename Head, typename... Tail>
void print(Head H, Tail... T) {
	std::cout << H << " ";
	print(T...);
}

template <class T>
void add(std::vector<T> &v, T val) {
	for(auto &a : v) a += val;
	return;
}

template <class T>
T dup(T a, T b) {
	assert(b != 0);
	return (a + b - 1) / b;
}

template <class T>
T greatest_lower_multiple(T x, T d) {
	if(d == 0) return 0;
	if(d < 0) d *= -1;
	T y = x % d;
	if(y < 0) y += d;
	return x - y;
}

template <class T>
T least_upper_multiple(T x, T d) {
	return -greatest_lower_multiple(-x, d);
}

long long POW(long long a, long long n) {
	long long res = 1;
	while(n > 0) {
		if(n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

long long modpow(long long a, long long n, long long mod) {	 // a^n mod
	assert(n >= 0 && mod);
	if(mod == 1) return 0LL;
	long long res = 1;
	a %= mod;
	while(n > 0) {
		if(n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res < 0 ? res + mod : res;
}

// return x which satisfies a * x % mod == gcd(a, mod)
// not (mod | a)
long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while(b) {
		long long t = a / b;
		a -= t * b;
		std::swap(a, b);
		u -= t * v;
		std::swap(u, v);
	}
	u %= mod;
	if(u < 0) u += mod;
	return u;
}

template <class T>
int lb(const std::vector<T> &a, const T x) {
	return std::distance(a.begin(), std::lower_bound(a.begin(), a.end(), x));
}
template <class T>
int ub(const std::vector<T> &a, const T x) {
	return std::distance(a.begin(), std::upper_bound(a.begin(), a.end(), x));
}
template <class T>
void unq_sort(std::vector<T> &a) {
	std::sort(a.begin(), a.end());
	a.erase(std::unique(a.begin(), a.end()), a.end());
}
template <class T>
std::vector<int> press(std::vector<T> &a) {
	auto vec = a;
	unq_sort(vec);
	std::vector<int> ret;
	for(auto &v : a) ret.push_back(lb(vec, v));
	return ret;
}

#pragma endregion

#pragma region input
#define VEC(type, name, size) \
	vector<type> name(size);  \
	scanner::INPUT(name)
#define VVEC(type, name, h, w)                     \
	vector<vector<type>> name(h, vector<type>(w)); \
	scanner::INPUT(name)
#define INT(...)     \
	int __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define LL(...)            \
	long long __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define STR(...)        \
	string __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define CHR(...)      \
	char __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define DBL(...)        \
	double __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define LD(...)              \
	long double __VA_ARGS__; \
	scanner::INPUT(__VA_ARGS__)
#define TPL3(type0, type1, type2, name)   \
	std::tuple<type0, type1, type2> name; \
	scanner::INPUT(name);
#define TPL4(type0, type1, type2, type3, name)   \
	std::tuple<type0, type1, type2, type3> name; \
	scanner::INPUT(name);

namespace scanner {
template <class T>
void scan(T &a) {
	std::cin >> a;
}

template <class T, class L>
void scan(std::pair<T, L> &p) {
	scan(p.first);
	scan(p.second);
}

template <class T0, class T1, class T2>
void scan(std::tuple<T0, T1, T2> &p) {
	T0 t0;
	T1 t1;
	T2 t2;
	scan(t0);
	scan(t1);
	scan(t2);
	p = std::make_tuple(t0, t1, t2);
}

template <class T0, class T1, class T2, class T3>
void scan(std::tuple<T0, T1, T2, T3> &p) {
	T0 t0;
	T1 t1;
	T2 t2;
	T3 t3;
	scan(t0);
	scan(t1);
	scan(t2);
	scan(t3);
	p = std::make_tuple(t0, t1, t2, t3);
}

template <class T>
void scan(std::vector<T> &a) {
	for(auto &i : a) scan(i);
}

void INPUT() {}
template <class Head, class... Tail>
void INPUT(Head &head, Tail &... tail) {
	scan(head);
	INPUT(tail...);
}
}  // namespace scanner

template <typename T1, typename T2>
std::istream &operator>>(std::istream &is, std::pair<T1, T2> &p) {
	is >> p.first >> p.second;
	return is;
}
#pragma endregion

#pragma region debug

#pragma region output
template <typename T1, typename T2>
std::ostream &std::operator<<(std::ostream &os, const std::pair<T1, T2> &p) {
	os << p.first << " " << p.second;
	return os;
}
template <class T>
std::ostream &std::operator<<(std::ostream &os, const std::vector<T> &v) {
	for(int i = 0; i < (int)v.size(); i++) {
		if(i) os << " ";
		os << v[i];
	}
	return os;
}
#pragma endregion

#pragma region view

namespace viewer {
void view(const long long e) {
	if(e == INF)
		std::cerr << "INF";
	else if(e == -INF)
		std::cerr << "-INF";
	else
		std::cerr << e;
}

void view(const int e) {
	if(e == inf)
		std::cerr << "inf";
	else if(e == -inf)
		std::cerr << "-inf";
	else
		std::cerr << e;
}

template <typename T>
void view(const T e) {
	std::cerr << e;
}

template <typename T, typename U>
void view(const std::pair<T, U> &p) {
	std::cerr << "(";
	view(p.first);
	std::cerr << ", ";
	view(p.second);
	std::cerr << ")";
}

template <class T0, class T1, class T2>
void view(const std::tuple<T0, T1, T2> &p) {
	std::cerr << "(";
	view(std::get<0>(p));
	std::cerr << ", ";
	view(std::get<1>(p));
	std::cerr << ", ";
	view(std::get<2>(p));
	std::cerr << ")";
}

template <class T0, class T1, class T2, class T3>
void view(const std::tuple<T0, T1, T2, T3> &p) {
	std::cerr << "(";
	view(std::get<0>(p));
	std::cerr << ", ";
	view(std::get<1>(p));
	std::cerr << ", ";
	view(std::get<2>(p));
	std::cerr << ", ";
	view(std::get<3>(p));
	std::cerr << ")";
}

template <typename T>
void view(const std::set<T> &s) {
	if(s.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(auto &t : s) {
		view(t);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::unordered_set<T> &s) {
	if(s.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(auto &t : s) {
		view(t);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::vector<T> &v) {
	if(v.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(const auto &e : v) {
		view(e);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::vector<std::vector<T>> &vv) {
	std::cerr << "{\n";
	for(const auto &v : vv) {
		std::cerr << "\t";
		view(v);
		std::cerr << '\n';
	}
	std::cerr << "}";
}

template <typename T, typename U>
void view(const std::vector<std::pair<T, U>> &v) {
	std::cerr << "{\n";
	for(const auto &c : v) {
		std::cerr << "\t(";
		view(c.first);
		std::cerr << ", ";
		view(c.second);
		std::cerr << ")\n";
	}
	std::cerr << "}";
}

template <class T0, class T1, class T2>
void view(const std::vector<std::tuple<T0, T1, T2>> &v) {
	if(v.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << '{';
	for(const auto &t : v) {
		std::cerr << "\n\t";
		view(t);
		std::cerr << ",";
	}
	std::cerr << "\n}";
}

template <class T0, class T1, class T2, class T3>
void view(const std::vector<std::tuple<T0, T1, T2, T3>> &v) {
	if(v.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << '{';
	for(const auto &t : v) {
		std::cerr << "\n\t";
		view(t);
		std::cerr << ",";
	}
	std::cerr << "\n}";
}

template <typename T, typename U>
void view(const std::map<T, U> &m) {
	std::cerr << "{\n";
	for(const auto &t : m) {
		std::cerr << "\t[";
		view(t.first);
		std::cerr << "] : ";
		view(t.second);
		std::cerr << '\n';
	}
	std::cerr << "}";
}

template <typename T, typename U>
void view(const std::unordered_map<T, U> &m) {
	std::cerr << "{\n";
	for(const auto &t : m) {
		std::cerr << "\t[";
		view(t.first);
		std::cerr << "] : ";
		view(t.second);
		std::cerr << '\n';
	}
	std::cerr << "}";
}
}  // namespace viewer

#pragma endregion

// when debugging : g++ foo.cpp -DLOCAL
#ifdef LOCAL
void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	viewer::view(H);
	std::cerr << ", ";
	debug_out(T...);
}
#define debug(...)                                                \
	do {                                                          \
		std::cerr << __LINE__ << " [" << #__VA_ARGS__ << "] : ["; \
		debug_out(__VA_ARGS__);                                   \
		std::cerr << "\b\b]\n";                                   \
	} while(0)
#define dump(x)                                      \
	do {                                             \
		std::cerr << __LINE__ << " " << #x << " : "; \
		viewer::view(x);                             \
		std::cerr << '\n';                           \
	} while(0)

#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

#pragma endregion

#pragma region geometry

using Real = long double;
using Point = complex<Real>;
using Vec = Point;
const Real EPS = 1e-10, PI = acos(-1);

inline bool eq(const Real &a, const Real &b) { return fabs(b - a) < EPS; }
inline bool eq(const Point &a, const Point &b) { return fabs(b - a) < EPS; }
/*
	-1: a < b
	0 : a == b
	1 : a > b
*/
inline int compare(const Real &a, const Real &b) { return eq(a, b) ? 0 : a < b ? -1 : 1; }

const Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// rotate point 'p' for counter clockwise direction
const Point rotate(const Real &theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

const Real radian_to_degree(const Real &r) { return (r * 180.0 / PI); }

const Real degree_to_radian(const Real &d) { return (d * PI / 180.0); }

// get angle a-b-c (<pi)
const Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), w(c - b);
	Real theta = fabs(atan2(w.imag(), w.real()) - atan2(v.imag(), v.real()));
	return min(theta, 2 * PI - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " -- " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

const Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
const Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
const int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;		// "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;		// "CLOCKWISE"
	if(dot(b, c) < -EPS) return +2;			// "ONLINE_BACK"
	if(norm(b) + EPS < norm(c)) return -2;	// "ONLINE_FRONT"
	return 0;								// "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
Point reflection(const Line &l, const Point &p) { return projection(l, p) * 2.0 - p; }

int intersect(const Line &l, const Point &p) { return int(abs(ccw(l.a, l.b, p)) != 1); }

int intersect(const Line &l, const Line &m) {
	if(intersect(l, m.a) && intersect(l, m.b)) return -1;
	return int(abs(cross(l.b - l.a, m.b - m.a)) > EPS);
}

int intersect(const Segment &s, const Point &p) { return int(ccw(s.a, s.b, p) == 0); }

int intersect(const Line &l, const Segment &s) {
	if(intersect(l, s.a) && intersect(l, s.b)) return -1;
	return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS;
}

Real distance(const Line &l, const Point &p);

int intersect(const Circle &c, const Line &l) {
	Real d = c.r - distance(l, c.p);
	return fabs(d) < EPS ? 1 : d > 0. ? 2 : 0;
}

int intersect(const Circle &c, const Point &p) { return int(abs(abs(p - c.p) - c.r) < EPS); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
int intersect(const Segment &s, const Segment &t) {
	if(eq(s.a, s.b)) return intersect(t, s.a);
	if(intersect(Line(s), t.a) && intersect(Line(s), t.b) &&
	   std::max(std::min(s.a, s.b), std::min(t.a, t.b)) < std::min(std::max(s.a, s.b), std::max(t.a, t.b)))
		return -1;
	return int(ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0);
}

int intersect(const Circle &c, const Segment &l) {
	const Point h = projection(l, c.p);
	if(norm(h - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(compare(d1, c.r) == -1 && compare(d2, c.r) == -1) return 0;
	if(d1 < c.r - EPS && d2 > c.r - EPS || d1 > c.r - EPS && d2 < c.r - EPS) return 1;
	return dot(l.a - h, l.b - h) < 0 ? 2 : 0;
}

Real distance(const Point &a, const Point &b);

int number_of_common_tangents(const Circle &c1, const Circle &c2) {
	Real r1 = min(c1.r, c2.r), r2 = max(c1.r, c2.r), d = distance(c1.p, c2.p);
	int com = compare(r1 + r2, d);
	return com == 1 ? compare(d + r1, r2) + 1 : 3 - com;
	// if(c1.r < c2.r) swap(c1, c2);
	// Real d = abs(c1.p - c2.p);
	// if(compare(c1.r + c2.r, d) == -1) return 4;
	// if(eq(c1.r + c2.r, d)) return 3;
	// if(compare(c1.r - c2.r, d) == -1) return 2;
	// return int(eq(c1.r - c2.r, d));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(const Circle &c1, const Circle &c2) { return 2 - abs(2 - number_of_common_tangents(c1, c2)); }

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	return intersect(s, r) ? distance(r, p) : min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	Vec v = (l.b - l.a) / abs(l.b - l.a) * sqrt(c.r * c.r - norm(pr - c.p));
	return make_pair(pr - v, pr + v);
	// Vec e = (l.b - l.a) / abs(l.b - l.a);
	// double base = sqrt(c.r * c.r - norm(pr - c.p));
	// return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	if(intersect(c, l) == 2) return crosspoint(c, Line(l.a, l.b));
	auto ret = crosspoint(c, Line(l.a, l.b));
	if(dot(l.a - ret.first, l.b - ret.first) < EPS)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // cosine theorem
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return make_pair(p1, p2);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Vec u = (c2.p - c1.p) / sqrt(g);
	Vec v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H
// 円と多角形の共通部分の面積
Real area(const Polygon &p, const Circle &c) {
	if(p.size() < 3) return 0.0;
	function<Real(Circle, Point, Point)> cross_area = [&](const Circle &c, const Point &a, const Point &b) {
		Point va = c.p - a, vb = c.p - b;
		Real f = cross(va, vb), ret = 0.0;
		if(eq(f, 0.0)) return ret;
		if(max(abs(va), abs(vb)) < c.r + EPS) return f;
		if(distance(Segment(a, b), c.p) > c.r - EPS) return c.r * c.r * arg(vb * conj(va));
		auto u = crosspoint(c, Segment(a, b));
		vector<Point> tot{a, u.first, u.second, b};
		for(int i = 0; i + 1 < tot.size(); i++) {
			ret += cross_area(c, tot[i], tot[i + 1]);
		}
		return ret;
	};
	Real A = 0;
	for(int i = 0; i < p.size(); i++) {
		A += cross_area(c, p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
// 凸多角形の直径(最遠頂点対間距離)
Real convex_diameter(const Polygon &p) {
	int N = (int)p.size();
	int is = 0, js = 0;
	for(int i = 1; i < N; i++) {
		if(p[i].imag() > p[is].imag()) is = i;
		if(p[i].imag() < p[js].imag()) js = i;
	}
	Real maxdis = norm(p[is] - p[js]);

	int maxi, maxj, i, j;
	i = maxi = is;
	j = maxj = js;
	do {
		if(cross(p[(i + 1) % N] - p[i], p[(j + 1) % N] - p[j]) >= 0) {
			j = (j + 1) % N;
		} else {
			i = (i + 1) % N;
		}
		if(norm(p[i] - p[j]) > maxdis) {
			maxdis = norm(p[i] - p[j]);
			maxi = i;
			maxj = j;
		}
	} while(i != is || j != js);
	return sqrt(maxdis);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
// 最近点対
Real closest_pair(Points ps) {
	if(ps.size() <= 1) throw(0);
	sort(begin(ps), end(ps));  // xでソート

	auto compare_y = [&](const Point &a, const Point &b) { return imag(a) < imag(b); };
	vector<Point> beet(ps.size());
	const Real INF = 1e18;

	function<Real(int, int)> rec = [&](int left, int right) {
		if(right - left <= 1) return INF;
		int mid = (left + right) >> 1;
		auto x = real(ps[mid]);	 // 領域内でx座標真中の点
		auto ret = min(rec(left, mid), rec(mid, right));
		// y座標でソートされた2つの区間をマージ
		inplace_merge(begin(ps) + left, begin(ps) + mid, begin(ps) + right, compare_y);
		int ptr = 0;
		for(int i = left; i < right; i++) {
			if(abs(real(ps[i]) - x) >= ret) continue;
			for(int j = 0; j < ptr; j++) {
				auto luz = ps[i] - beet[ptr - j - 1];
				if(imag(luz) >= ret) break;
				ret = min(ret, abs(luz));
			}
			beet[ptr++] = ps[i];
		}
		return ret;
	};
	return rec(0, (int)ps.size());
}

// (aからの距離):(bからの距離) = dist_a : dist_b となる点の集合(円)を返す
Circle Apollonius_Circle(Point a, Point b, Real dist_a, Real dist_b) {
	assert(!eq(dist_a, dist_b));  //同じ場合はbisectionで
	Real asq = dist_a * dist_a, bsq = dist_b * dist_b;
	Point p = (a * bsq - b * asq) * (1 / (bsq - asq));
	Real r = abs(a - b) * dist_a * dist_b / abs(asq - bsq);
	return Circle(p, r);
}

// bisection of angle A-B-C
// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_B/judge/5763316/C++17
Line bisection_of_angle(const Point &a, const Point &b, const Point &c) {
	Real da = distance(a, b);
	Real dc = distance(b, c);
	return Line(b, (a * dc + c * da) / (da + dc));
}

// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_B/judge/5763316/C++17
Circle incircle_of_triangle(const Point &a, const Point &b, const Point &c) {
	Point center = crosspoint(bisection_of_angle(a, b, c), bisection_of_angle(b, c, a));
	return Circle(center, distance(Line(a, b), center));
}
Circle incircle_of_triangle(const Polygon &p) { return incircle_of_triangle(p[0], p[1], p[2]); }

// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_C/judge/5763330/C++17
Line bisection_of_points(const Point &a, const Point &b) {
	Point c = (a + b) * 0.5;
	return Line(c, c + rotate(PI / 2, b - a));
}

// https://onlinejudge.u-aizu.ac.jp/status/users/Kite_kuma/submissions/1/CGL_7_C/judge/5763330/C++17
Circle circumscribed_circle_of_triangle(const Point &a, const Point &b, const Point &c) {
	Point center = crosspoint(bisection_of_points(a, b), bisection_of_points(b, c));
	return Circle(center, distance(a, center));
}
Circle circumscribed_circle_of_triangle(const Polygon &p) { return circumscribed_circle_of_triangle(p[0], p[1], p[2]); }

#pragma endregion

using R = Real;
R solve() {
	int n;
	cin >> n;
	if(n == 0) exit(0);
	R w;
	cin >> w;

	Points needles_place;
	V<R> needles_height;
	rep(n) {
		Real x, y, h;
		cin >> x >> y >> h;
		needles_place.emplace_back(x, y);
		needles_height.push_back(h);
	}

	auto min_dist = [&](R radius, R hieght) -> R {
		if(radius < hieght) return radius;
		return R(sqrt(radius * radius - (radius - hieght) * (radius - hieght)));
	};

	Lines walls;
	walls.emplace_back(Point(0, 0), Point(0, 100));
	walls.emplace_back(Point(100, 100), Point(0, 100));
	walls.emplace_back(Point(0, 0), Point(100, 0));
	walls.emplace_back(Point(100, 100), Point(100, 0));

	Lines internal;
	Circles cs(n);

	Points crs;

	auto safe = [&](const Point &center, const R &radius) {
		if(isnan(center.real())) return false;
		if(isnan(center.imag())) return false;

		if(compare(center.real(), 0) == -1 || compare(center.real(), 100) == 1 || compare(center.imag(), 0) == -1 ||
		   compare(center.imag(), 100) == 1) {
			// if(radius > 1. && radius < 3) debug(center, radius);
			return false;
		}

		rep(i, n) {
			if(compare(min_dist(radius, needles_height[i]), distance(center, needles_place[i])) == 1) return false;
		}

		R min_dist_wall = min_dist(radius, w);
		foa(wall, walls) {
			if(compare(min_dist_wall, distance(wall, center)) == 1) return false;
		}
		return true;
	};

	auto f = [&](R radius) {
		internal.clear();
		crs.clear();
		R min_dist_wall = min_dist(radius, w);
		internal.emplace_back(Point(min_dist_wall, 0), Point(min_dist_wall, 100));
		internal.emplace_back(Point(100, 100 - min_dist_wall), Point(0, 100 - min_dist_wall));
		internal.emplace_back(Point(0, min_dist_wall), Point(100, min_dist_wall));
		internal.emplace_back(Point(100 - min_dist_wall, 100), Point(100 - min_dist_wall, 0));

		rep(i, n) { cs[i] = Circle(needles_place[i], min_dist(radius, needles_height[i])); }

		foa(ln, internal) {
			foa(ln2, internal) {
				if(intersect(ln, ln2)) crs.push_back(crosspoint(ln, ln2));
			}

			foa(c, cs) {
				if(intersect(c, ln)) {
					auto ps = crosspoint(c, ln);
					crs.push_back(ps.first);
					crs.push_back(ps.second);
				}
			}
		}

		foa(c, cs) {
			foa(d, cs) {
				if(intersect(c, d) > 0) {
					auto ps = crosspoint(c, d);
					crs.push_back(ps.first);
					crs.push_back(ps.second);
				}
			}
		}

		foa(pt, crs) {
			if(isnan(pt.real())) continue;
			// if(radius < 1.) debug(radius, pt);
			if(safe(pt, radius)) {
				if(radius > 10000000000000.) debug(pt, radius);
				return true;
			}
		}
		return false;
	};

	R ok = 0.;
	R ng = inf;
	rep(200) {
		R med = (ok + ng) / 2;
		if(f(med)) {
			ok = med;
		} else {
			ng = med;
		}
	}
	return ok;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout << std::fixed << std::setprecision(15);
	srand((unsigned)time(NULL));

	while(1) cout << solve() << dl;

	return 0;
}
accuracy: 1
time_ms: 5080
memory_kb: 3980
final_rank: 19

code_snippet: #include <bits/stdc++.h>
using namespace std;
const double EPS = 0.0000001;
struct point{
  double x, y;
  point(){
  }
  point(double x, double y): x(x), y(y){
  }
  point operator +(point P){
    return point(x + P.x, y + P.y);
  }
  point operator -(point P){
    return point(x - P.x, y - P.y);
  }
  point operator *(double k){
    return point(x * k, y * k);
  }
  point operator /(double k){
    return point(x / k, y / k);
  }
};
point rotate90(point P){
  return point(P.y, -P.x);
}
double abs(point P){
  return sqrt(P.x * P.x + P.y * P.y);
}
double dist(point P, point Q){
  return abs(Q - P);
}
double dot(point P, point Q){
  return P.x * Q.x + P.y * Q.y;
}
double cross(point P, point Q){
  return P.x * Q.y - P.y * Q.x;
}
struct line{
  point A, B;
  line(){
  }
  line(point A, point B): A(A), B(B){
  }
};
point vec(line L){
  return L.B - L.A;
}
double point_line_distance(point P, line L){
  return abs(cross(P - L.A, vec(L))) / abs(vec(L));
}
point projection(point P, line L){
  return L.A + vec(L) / abs(vec(L)) * dot(P - L.A, vec(L)) / abs(vec(L));
}
struct circle{
  point C;
  double r;
  circle(){
  }
  circle(point C, double r): C(C), r(r){
  }
};
bool point_in_circle(point P, circle C){
  return dist(P, C.C) < C.r - EPS;
}
bool line_circle_intersects(line L, circle C){
  return point_line_distance(C.C, L) < C.r - EPS;
}
pair<point, point> line_circle_intersection(line L, circle C){
  point P = projection(C.C, L);
  double d = point_line_distance(C.C, L);
  double h = sqrt(C.r * C.r - d * d);
  point A = P + vec(L) / abs(vec(L)) * h;
  point B = P - vec(L) / abs(vec(L)) * h;
  return make_pair(A, B);
}
bool circle_intersects(circle C1, circle C2){
  double d = dist(C1.C, C2.C);
  return abs(C1.r - C2.r) + EPS < d && d < C1.r + C2.r - EPS;
}
pair<point, point> circle_intersection(circle C1, circle C2){
  double d = dist(C1.C, C2.C);
  double d2 = (C1.r * C1.r + d * d - C2.r * C2.r) / (2 * d);
  point M = C1.C + (C2.C - C1.C) / d * d2;
  double h = sqrt(C1.r * C1.r - d2 * d2);
  point D = rotate90(C2.C - C1.C);
  point A = M + D / abs(D) * h;
  point B = M - D / abs(D) * h;
  return make_pair(A, B);
}
int main(){
  while (true){
    int n;
    double w;
    cin >> n >> w;
    if (n == 0 && w == 0){
      break;
    }
    vector<point> P(n);
    vector<double> h(n);
    for (int i = 0; i < n; i++){
      cin >> P[i].x >> P[i].y >> h[i];
    }
    double tv = 0, fv = 10000;
    for (int i = 0; i < 50; i++){
      double r = (tv + fv) / 2;
      double t;
      if (r < w){
        t = r;
      } else {
        t = sqrt(r * r - (r - w) * (r - w));
      }
      if (t > 50){
        fv = r;
      } else {
        vector<line> L(4);
        L[0] = line(point(t, t), point(t, 100 - t));
        L[1] = line(point(100 - t, t), point(100 - t, 100 - t));
        L[2] = line(point(t, t), point(100 - t, t));
        L[3] = line(point(t, 100 - t), point(100 - t, 100 - t));
        vector<circle> C(n);
        for (int j = 0; j < n; j++){
          if (r < h[j]){
            C[j] = circle(P[j], r);
          } else {
            C[j] = circle(P[j], sqrt(r * r - (r - h[j]) * (r - h[j])));
          }
        }
        vector<point> Q;
        Q.push_back(point(t, t));
        Q.push_back(point(t, 100 - t));
        Q.push_back(point(100 - t, t));
        Q.push_back(point(100 - t, 100 - t));
        for (int j = 0; j < n; j++){
          for (int k = 0; k < 4; k++){
            if (line_circle_intersects(L[k], C[j])){
              pair<point, point> I = line_circle_intersection(L[k], C[j]);
              Q.push_back(I.first);
              Q.push_back(I.second);
            }
          }
          for (int k = j + 1; k < n; k++){
            if (circle_intersects(C[j], C[k])){
              pair<point, point> I = circle_intersection(C[j], C[k]);
              Q.push_back(I.first);
              Q.push_back(I.second);
            }
          }
        }
        int cnt = Q.size();
        bool ok = false;
        for (int j = 0; j < cnt; j++){
          bool ok2 = true;
          if (Q[j].x < t - EPS || Q[j].x > 100 - t + EPS || Q[j].y < t - EPS || Q[j].y > 100 - t + EPS){
            ok2 = false;
          }
          for (int k = 0; k < n; k++){
            if (point_in_circle(Q[j], C[k])){
              ok2 = false;
            }
          }
          if (ok2){
            ok = true;
          }
        }
        if (ok){
          tv = r;
        } else {
          fv = r;
        }
      }
    }
    cout << tv << endl;
  }
}
accuracy: 1
time_ms: 120
memory_kb: 3252
final_rank: 2

code_snippet: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

struct Needle {
	long double x, y, z;
	Needle() {
		cin >> x >> y >> z;
	}
	Needle(long double xx, long double yy, long double zz) :x(xx), y(yy), z(zz) {

	}
};

struct Point {
	long double x, y, z;
	Point(long double xx, long double yy, long double zz) :x(xx), y(yy), z(zz) {

	}
};

long double Dist(Needle n, Point p) {
	n.z = min(n.z, p.z);
	//cout << hypot(hypot(n.x - p.x, n.y - p.y), n.z - p.z) << endl;
	return hypot(hypot(n.x - p.x, n.y - p.y), n.z - p.z);
}

vector<Point>CircleCross(Needle a,long double ar,Needle b, long double br) {
	vector<Point>ret;
	Point dp(b.x - a.x, b.y - a.y, a.z);
	auto dis = hypot(a.x - b.x, a.y - b.y);
	if (ar + br < dis)return ret;
	if (abs(ar - br) >= dis)return ret;
	if (abs(ar + br - dis) <= EPS) {
		ret.push_back(Point(a.x + b.x * (ar / (ar + br)), a.y + b.y * (ar / (ar + br)), a.z));
		return ret;
	}
	if (abs(abs(ar - br) - dis) <= EPS) {
		ret.push_back(Point(a.x + b.x * (ar / (ar - br)), a.y + b.y * (ar / (ar - br)), a.z));
		return ret;
	}
	long double ad;
	if (dis < 1) {
		cout << dis << endl;
	}
	ad = (ar*ar - br*br + dis * dis) / 2 / dis;
	Point cp(a.x + dp.x*(ad / dis), a.y + dp.y*(ad / dis), a.z);
	if (abs(ar) < abs(ad)) {
		cout << ar << " " << br << " " << dis << endl;
		cout << ar << " " << ad << endl;
	}
	long double amari = sqrt(ar*ar - ad * ad);
	ret.push_back(Point(cp.x - dp.y*amari / dis, cp.y + dp.x*amari / dis, cp.z));
	ret.push_back(Point(cp.x + dp.y*amari / dis, cp.y - dp.x*amari / dis, cp.z));
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	while (cin >> N >> H, N) {
		vector<Needle>n(N);
		long double mx = (H*H + (long double)2500) / (2 * H);
		if (H >= 50) {
			mx = 50;
		}
		long double l = 0, r = mx;
		for (int loop = 0; loop < 50; loop++) {
			long double mid = (l + r) / 2;
			vector<Point>p;
			{
				long double d = 0;
				if (mid <= H) {
					d = mid;
				}
				else {
					d = sqrt(mid*H * 2 - H * H);
				}
				p.push_back(Point(d, d, mid));
				p.push_back(Point(100 - d, d, mid));
				p.push_back(Point(d, 100 - d, mid));
				p.push_back(Point(100 - d, 100 - d, mid));
				for (auto i : n) {
					long double r = 0;
					if (mid <= i.z) {
						r = mid;
					}
					else {
						r = sqrt(mid*i.z * 2 - i.z*i.z);
					}
			//		cout << mid << " " << d << " " << r << endl;
					if (i.x + r > d && i.x - r < d) {
						if (abs(r) < abs(i.x - d)) {
							cout << "aaaaaaaaaaaaaaaaaaaaaaaa" << endl;
						}
						long double dif = sqrt(r*r - (i.x - d)*(i.x - d));
						p.push_back(Point(d, i.y - dif, mid));
						p.push_back(Point(d, i.y + dif, mid));
					}
					if (i.x + r > 100 - d && i.x - r < 100 - d) {
						if (abs(r) < abs(i.x - (100 - d))) {
							cout << "aaaaaaaaaaaaaaaaaaaaaaaa" << endl;
						}
						long double dif = sqrt(r*r - (i.x - (100 - d))*(i.x - (100 - d)));
						p.push_back(Point(100 - d, i.y - dif, mid));
						p.push_back(Point(100 - d, i.y + dif, mid));
					}
					if (i.y + r > d && i.y - r < d) {
						if (abs(r) < abs(i.y-d)) {
							cout << "aaaaaaaaaaaaaaaaaaaaaaaa" << endl;
						}
						long double dif = sqrt(r*r - (i.y - d)*(i.y - d));
						p.push_back(Point(i.x - dif, d, mid));
						p.push_back(Point(i.x + dif, d, mid));
					}
					if (i.y + r > 100 - d && i.y - r < 100 - d) {
						if (abs(r) < abs(i.y - (100 - d))) {
							cout << "aaaaaaaaaaaaaaaaaaaaaaaa" << endl;
						}
						long double dif = sqrt(r*r - (i.y - (100 - d))*(i.y - (100 - d)));
						p.push_back(Point(i.x - dif, 100 - d, mid));
						p.push_back(Point(i.x + dif, 100 - d, mid));
					}
				}
			}
			{
				for (int i = 0; i < N; i++) {
					for (int j = i + 1; j < N; j++) {
						auto box = CircleCross(n[i], sqrt(mid*mid - max((long double)0, (mid - n[i].z))*max((long double)0,(mid - n[i].z))), n[j], sqrt(mid*mid - max((long double)0, (mid - n[j].z))*max((long double)0, (mid - n[j].z))));
						for (auto k : box) {
							k.z = mid;
							p.push_back(k);
						}
					}
				}
			}
			long double flag = 0;
			for (auto i : p) {
			//	cout << i.x << " " << i.y << " " << i.z << " " << mid << endl;
				if (i.x < 0 || i.y < 0 || i.x >= 100 || i.y >= 100)continue;
				long double dis = 20000;
				n.push_back(Needle(i.x, 0, H));
				n.push_back(Needle(i.x, 100, H));
				n.push_back(Needle(0, i.y, H));
				n.push_back(Needle(100, i.y, H));
				for (auto j : n) {
					dis = min(dis, Dist(j, i));
				}
				n.pop_back();
				n.pop_back();
				n.pop_back();
				n.pop_back();
				flag = max(flag, dis);
				//cout << dis << " " << mid << endl;
				//if (dis >= mid - EPS) {
				//	cout << i.x << " " << i.y << " " << i.z << endl;
				//}
			}
		//	cout << flag << " " << mid << endl;
			if (flag>=mid-EPS) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
		cout << fixed << setprecision(20) << r << endl;
	}
}
accuracy: 1
time_ms: 1550
memory_kb: 3436
final_rank: 5

code_snippet: #pragma GCC optimize("Ofast")
//#ifndef ONLINE_JUDGE 
//#define _GLIBCXX_DEBUG
//#endif
#ifdef ONLINE_JUDGE 
#include <atcoder/all>
#endif
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <math.h>
#include <complex>
 
 
using namespace std;
#ifdef ONLINE_JUDGE 
using namespace atcoder;
#endif
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
#ifdef ONLINE_JUDGE 
//using mint = modint998244353;
//using mint = modint;
using mint = modint1000000007;
#endif
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
using Real = long double;  //時間がかかる割にdoubleと大差ない
using Point = complex<Real>;
const Real EPS = 1e-10, /*1e-8はたまに落ちる*/ PI = acos(-1);

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }  //誤差無視の等式

//実スカラー倍
Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

// point入力受け取り
istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
// point出力
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// 点 p を反時計回りに theta 回転
Point rotate(Real theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r) { return (r * 180.0 / PI); }

Real degree_to_radian(Real d) { return (d * PI / 180.0); }

// a-b-c の角度のうち小さい方を返す
Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), /* もとはv(b-a)になってたので修正 */ w(c - b);
	Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
	if(alpha > beta) swap(alpha, beta);
	Real theta = (beta - alpha);
	return min(theta, 2 * acos(-1) - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " to " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

//外積
Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
//内積
Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;   // "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;  // "CLOCKWISE"
	if(dot(b, c) < 0) return +2;	   // "ONLINE_BACK"
	if(norm(b) < norm(c)) return -2;   // "ONLINE_FRONT"
	return 0;						   // "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// 射影
// 直線 l に p から垂線を引いた交点を求める
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// 反射
// 直線 l を対称軸として点 p  と線対称にある点を求める
Point reflection(const Line &l, const Point &p) { return p + (projection(l, p) - p) * 2.0; }

bool intersect(const Line &l, const Point &p) { return abs(ccw(l.a, l.b, p)) != 1; }

bool intersect(const Line &l, const Line &m) { return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS; }

bool intersect(const Segment &s, const Point &p) { return ccw(s.a, s.b, p) == 0; }

bool intersect(const Line &l, const Segment &s) { return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS; }

Real distance(const Line &l, const Point &p);

bool intersect(const Circle &c, const Line &l) { return distance(l, c.p) <= c.r + EPS; }

bool intersect(const Circle &c, const Point &p) { return abs(abs(p - c.p) - c.r) < EPS; }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
// 線分同士の交差判定　(端点が他方の線分上にあるならば交差とみなす)
bool intersect(const Segment &s, const Segment &t) {
	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l) {
	if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
	if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
	const Point h = projection(l, c.p);
	if(dot(l.a - h, l.b - h) < 0) return 2;
	return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2) {
	if(c1.r < c2.r) swap(c1, c2);
	Real d = abs(c1.p - c2.p);
	if(c1.r + c2.r < d) return 4;	  // 外に離れている
	if(eq(c1.r + c2.r, d)) return 3;  // 外接
	if(c1.r - c2.r < d) return 2;	  // 交差
	if(eq(c1.r - c2.r, d)) return 1;  // 内接
	return 0;						  // 内包
}

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	if(intersect(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	Point e = (l.b - l.a) / abs(l.b - l.a);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	double base = sqrt(c.r * c.r - norm(pr - c.p));
	return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	Line aa = Line(l.a, l.b);
	if(intersect(c, l) == 2) return crosspoint(c, aa);
	auto ret = crosspoint(c, aa);
	if(dot(l.a - ret.first, l.b - ret.first) < 0)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // 余弦定理
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return {p1, p2};
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Point u = (c2.p - c1.p) / sqrt(g);
	Point v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B
// 凸性判定 (反時計回り)
bool is_convex(const Polygon &p) {
	int n = (int)p.size();
	for(int i = 0; i < n; i++) {
		if(ccw(p[(i + n - 1) % n], p[i], p[(i + 1) % n]) == -1) return false;
	}
	return true;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A
// 凸包
Polygon convex_hull(Polygon &p) {
	int n = (int)p.size(), k = 0;
	if(n <= 2) return p;
	sort(p.begin(), p.end());  // x -> yの順にソート
	vector<Point> ch(2 * n);
	for(int i = 0; i < n; ch[k++] = p[i++]) {  //下半分を構成
		while(k >= 2 && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {  //上半分を構成
		while(k >= t && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	ch.resize(k - 1);
	return ch;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C
// 多角形と点の包含判定
enum { OUT, ON, IN };

int contains(const Polygon &Q, const Point &p) {
	bool in = false;
	for(int i = 0; i < Q.size(); i++) {
		Point a = Q[i] - p, b = Q[(i + 1) % Q.size()] - p;
		if(a.imag() > b.imag()) swap(a, b);
		if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0) in = !in;
		if(cross(a, b) == 0 && dot(a, b) <= 0) return ON;
	}
	return in ? IN : OUT;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分の重複除去
void merge_segments(vector<Segment> &segs) {
	auto merge_if_able = [](Segment &s1, const Segment &s2) {
		if(abs(cross(s1.b - s1.a, s2.b - s2.a)) > EPS) return false;
		if(ccw(s1.a, s2.a, s1.b) == 1 || ccw(s1.a, s2.a, s1.b) == -1) return false;
		if(ccw(s1.a, s1.b, s2.a) == -2 || ccw(s2.a, s2.b, s1.a) == -2) return false;
		s1 = Segment(min(s1.a, s2.a), max(s1.b, s2.b));
		return true;
	};

	for(int i = 0; i < segs.size(); i++) {
		if(segs[i].b < segs[i].a) swap(segs[i].a, segs[i].b);
	}
	for(int i = 0; i < segs.size(); i++) {
		for(int j = i + 1; j < segs.size(); j++) {
			if(merge_if_able(segs[i], segs[j])) {
				segs[j--] = segs.back(), segs.pop_back();
			}
		}
	}
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分アレンジメント
// 任意の2線分の交点を頂点としたグラフを構築する
vector<vector<int>> segment_arrangement(vector<Segment> &segs, vector<Point> &ps) {
	vector<vector<int>> g;
	int N = (int)segs.size();
	for(int i = 0; i < N; i++) {
		ps.emplace_back(segs[i].a);
		ps.emplace_back(segs[i].b);
		for(int j = i + 1; j < N; j++) {
			const Point p1 = segs[i].b - segs[i].a;
			const Point p2 = segs[j].b - segs[j].a;
			if(eq(cross(p1, p2), 0)) continue;	// " == 0" となっていたのを訂正
			if(intersect(segs[i], segs[j])) {
				ps.emplace_back(crosspoint(segs[i], segs[j]));
			}
		}
	}
	sort(begin(ps), end(ps));
	ps.erase(unique(begin(ps), end(ps)), end(ps));	// これ誤差とか大丈夫なのか？

	int M = (int)ps.size();
	g.resize(M);
	for(int i = 0; i < N; i++) {
		vector<int> vec;
		for(int j = 0; j < M; j++) {
			if(intersect(segs[i], ps[j])) {
				vec.emplace_back(j);
			}
		}
		for(int j = 1; j < vec.size(); j++) {
			g[vec[j - 1]].push_back(vec[j]);
			g[vec[j]].push_back(vec[j - 1]);
		}
	}
	return (g);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C
// 凸多角形の切断
// 直線 l.a-l.b で切断しその左側にできる凸多角形を返す
Polygon convex_cut(const Polygon &U, Line l) {
	Polygon ret;
	for(int i = 0; i < U.size(); i++) {
		Point now = U[i], nxt = U[(i + 1) % U.size()];
		if(ccw(l.a, l.b, now) != -1) ret.push_back(now);
		if(ccw(l.a, l.b, now) * ccw(l.a, l.b, nxt) < 0) {
			ret.push_back(crosspoint(Line(now, nxt), l));
		}
	}
	return (ret);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A
// 多角形の面積
Real area(const Polygon &p) {
	Real A = 0;
	for(int i = 0; i < p.size(); ++i) {
		A += cross(p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H
// 円と多角形の共通部分の面積
Real area(const Polygon &p, const Circle &c) {
	if(p.size() < 3) return 0.0;
	function<Real(Circle, Point, Point)> cross_area = [&](const Circle &c, const Point &a, const Point &b) {
		Point va = c.p - a, vb = c.p - b;
		Real f = cross(va, vb), ret = 0.0;
		if(eq(f, 0.0)) return ret;
		if(max(abs(va), abs(vb)) < c.r + EPS) return f;
		if(distance(Segment(a, b), c.p) > c.r - EPS) return c.r * c.r * arg(vb * conj(va));	 // 0.5倍してなくない？
		auto u = crosspoint(c, Segment(a, b));
		vector<Point> tot{a, u.first, u.second, b};
		for(int i = 0; i + 1 < tot.size(); i++) {
			ret += cross_area(c, tot[i], tot[i + 1]);
		}
		return ret;
	};
	Real A = 0;
	for(int i = 0; i < p.size(); i++) {
		A += cross_area(c, p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;	 // 0.5倍が抜けていたので修正;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
// 凸多角形の直径(最遠頂点対間距離)
Real convex_diameter(const Polygon &p) {
	int N = (int)p.size();
	int is = 0, js = 0;
	for(int i = 1; i < N; i++) {
		if(p[i].imag() > p[is].imag()) is = i;
		if(p[i].imag() < p[js].imag()) js = i;
	}
	Real maxdis = norm(p[is] - p[js]);

	int maxi, maxj, i, j;
	i = maxi = is;
	j = maxj = js;
	do {
		if(cross(p[(i + 1) % N] - p[i], p[(j + 1) % N] - p[j]) >= 0) {
			j = (j + 1) % N;
		} else {
			i = (i + 1) % N;
		}
		if(norm(p[i] - p[j]) > maxdis) {
			maxdis = norm(p[i] - p[j]);
			maxi = i;
			maxj = j;
		}
	} while(i != is || j != js);
	return sqrt(maxdis);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
// 最近点対
Real closest_pair(Points ps) {
	if(ps.size() <= 1) throw(0);
	sort(begin(ps), end(ps));  // xでソート

	auto compare_y = [&](const Point &a, const Point &b) { return imag(a) < imag(b); };
	vector<Point> beet(ps.size());
	const Real INF = 1e18;

	function<Real(int, int)> rec = [&](int left, int right) {
		if(right - left <= 1) return INF;
		int mid = (left + right) >> 1;
		auto x = real(ps[mid]);	 // 領域内でx座標真中の点
		auto ret = min(rec(left, mid), rec(mid, right));
		// y座標でソートされた2つの区間をマージ
		inplace_merge(begin(ps) + left, begin(ps) + mid, begin(ps) + right, compare_y);
		int ptr = 0;
		for(int i = left; i < right; i++) {
			if(abs(real(ps[i]) - x) >= ret) continue;
			for(int j = 0; j < ptr; j++) {
				auto luz = ps[i] - beet[ptr - j - 1];
				if(imag(luz) >= ret) break;
				ret = min(ret, abs(luz));
			}
			beet[ptr++] = ps[i];
		}
		return ret;
	};
	return rec(0, (int)ps.size());
}

// (aからの距離):(bからの距離) = dist_a : dist_b となる点の集合(円)を返す
Circle Apollonius_Circle(Point a, Point b, Real dist_a, Real dist_b) {
	assert(!eq(dist_a, dist_b));  //同じ場合はbisectionで
	Real asq = dist_a * dist_a, bsq = dist_b * dist_b;
	Point p = (a * bsq - b * asq) * (1 / (bsq - asq));
	Real r = abs(a - b) * dist_a * dist_b / abs(asq - bsq);
	return Circle(p, r);
}

// 二等分線
Line bisection(Point a, Point b) {
	a = (a + b) * 0.5;
	b = rotate(PI / 2, b - a) + a;
	return Line(a, b);
}

 
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);
 
  while(1) {
    ll N,W; cin>>N>>W; if(!N&&!W) break;
    
    Points P(N);
    vector<Real> H(N);
    rep(i,N) cin>>P[i]>>H[i];
    
    vector<Real> R(N);
    Real l,r,u,d;
    
    auto judge=[&](Real sphere){
      rep(i,N) {
        if(H[i]>sphere) R[i]=sphere;
        else R[i]=sqrt(pow(sphere,2)-pow(sphere-H[i],2));
      }
      auto hasi=(sphere>W?sqrt(pow(sphere,2)-pow(sphere-W,2)):sphere);
      l=hasi,r=100.0-hasi,u=hasi,d=100.0-hasi;
      
      auto safe=[&](Real x,Real y) {
        if(x<l-EPS||x>r+EPS||y<u-EPS||y>d+EPS) return false;
        rep(i,N) {
          if(distance(P[i],Point(x,y))<R[i]-EPS) return false;
        }
        return true;
      };
      
      auto safepoint=[&](Point p) {return safe(p.real(),p.imag());};
      
      if(safe(l,u)||safe(l,d)||safe(r,u)||safe(r,d)) return true;
      
      rep(i,N) for(int j=i+1;j<N;j++) {
        int num=intersect(Circle(P[i],R[i]),Circle(P[j],R[j]));
        if(num==0||num==4) continue;
        auto [p1,p2]=crosspoint(Circle(P[i],R[i]),Circle(P[j],R[j]));
        if(safepoint(p1)||safepoint(p2)) return true;
      }
      
      Points points(4);
      points[0]=Point(l,u);
      points[1]=Point(l,d);
      points[2]=Point(r,u);
      points[3]=Point(r,d);
      
      Lines lines(4);
      lines[0]=Line(points[0],points[1]);
      lines[1]=Line(points[1],points[2]);
      lines[2]=Line(points[2],points[3]);
      lines[3]=Line(points[3],points[0]);
      
      rep(i,N) rep(j,4) {
        if(!intersect(Circle(P[i],R[i]),lines[j])) continue;
        auto [p1,p2]=crosspoint(Circle(P[i],R[i]),lines[j]);
        if(safepoint(p1)||safepoint(p2)) return true;
      }
      
      return false;
    };
    
    Real ok=0.0;
    Real ng=10000.0;
    rep(_,100) {
      Real mid=(ok+ng)/2;
      (judge(mid)?ok:ng)=mid;
    }
    
    cout<<ok<<'\n';
  }

  return 0;
}
accuracy: 1
time_ms: 300
memory_kb: 3568
final_rank: 4

code_snippet: #include <bits/stdc++.h>
using namespace std;

#pragma region geometry

using Real = long double;  //時間がかかる割にdoubleと大差ない
using Point = complex<Real>;
const Real EPS = 1e-10, /*1e-8はたまに落ちる*/ PI = acos(-1);

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }  //誤差無視の等式

//実スカラー倍
Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

// point入力受け取り
istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
// point出力
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// 点 p を反時計回りに theta 回転
Point rotate(Real theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r) { return (r * 180.0 / PI); }

Real degree_to_radian(Real d) { return (d * PI / 180.0); }

// a-b-c の角度のうち小さい方を返す
Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), /* もとはv(b-a)になってたので修正 */ w(c - b);
	Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
	if(alpha > beta) swap(alpha, beta);
	Real theta = (beta - alpha);
	return min(theta, 2 * acos(-1) - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " to " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

//外積
Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
//内積
Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;   // "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;  // "CLOCKWISE"
	if(dot(b, c) < 0) return +2;	   // "ONLINE_BACK"
	if(norm(b) < norm(c)) return -2;   // "ONLINE_FRONT"
	return 0;						   // "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// 射影
// 直線 l に p から垂線を引いた交点を求める
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// 反射
// 直線 l を対称軸として点 p  と線対称にある点を求める
Point reflection(const Line &l, const Point &p) { return p + (projection(l, p) - p) * 2.0; }

bool intersect(const Line &l, const Point &p) { return abs(ccw(l.a, l.b, p)) != 1; }

bool intersect(const Line &l, const Line &m) { return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS; }

bool intersect(const Segment &s, const Point &p) { return ccw(s.a, s.b, p) == 0; }

bool intersect(const Line &l, const Segment &s) { return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS; }

Real distance(const Line &l, const Point &p);

bool intersect(const Circle &c, const Line &l) { return distance(l, c.p) <= c.r + EPS; }

bool intersect(const Circle &c, const Point &p) { return abs(abs(p - c.p) - c.r) < EPS; }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
// 線分同士の交差判定　(端点が他方の線分上にあるならば交差とみなす)
bool intersect(const Segment &s, const Segment &t) {
	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l) {
	if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
	if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
	const Point h = projection(l, c.p);
	if(dot(l.a - h, l.b - h) < 0) return 2;
	return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2) {
	if(c1.r < c2.r) swap(c1, c2);
	Real d = abs(c1.p - c2.p);
	if(c1.r + c2.r < d) return 4;	  // 外に離れている
	if(eq(c1.r + c2.r, d)) return 3;  // 外接
	if(c1.r - c2.r < d) return 2;	  // 交差
	if(eq(c1.r - c2.r, d)) return 1;  // 内接
	return 0;						  // 内包
}

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	if(intersect(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	Point e = (l.b - l.a) / abs(l.b - l.a);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	double base = sqrt(c.r * c.r - norm(pr - c.p));
	return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	Line aa = Line(l.a, l.b);
	if(intersect(c, l) == 2) return crosspoint(c, aa);
	auto ret = crosspoint(c, aa);
	if(dot(l.a - ret.first, l.b - ret.first) < 0)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // 余弦定理
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return {p1, p2};
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Point u = (c2.p - c1.p) / sqrt(g);
	Point v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B
// 凸性判定 (反時計回り)
bool is_convex(const Polygon &p) {
	int n = (int)p.size();
	for(int i = 0; i < n; i++) {
		if(ccw(p[(i + n - 1) % n], p[i], p[(i + 1) % n]) == -1) return false;
	}
	return true;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A
// 凸包
Polygon convex_hull(Polygon &p) {
	int n = (int)p.size(), k = 0;
	if(n <= 2) return p;
	sort(p.begin(), p.end());  // x -> yの順にソート
	vector<Point> ch(2 * n);
	for(int i = 0; i < n; ch[k++] = p[i++]) {  //下半分を構成
		while(k >= 2 && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {  //上半分を構成
		while(k >= t && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	ch.resize(k - 1);
	return ch;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C
// 多角形と点の包含判定
enum { OUT, ON, IN };

int contains(const Polygon &Q, const Point &p) {
	bool in = false;
	for(int i = 0; i < Q.size(); i++) {
		Point a = Q[i] - p, b = Q[(i + 1) % Q.size()] - p;
		if(a.imag() > b.imag()) swap(a, b);
		if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0) in = !in;
		if(cross(a, b) == 0 && dot(a, b) <= 0) return ON;
	}
	return in ? IN : OUT;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分の重複除去
void merge_segments(vector<Segment> &segs) {
	auto merge_if_able = [](Segment &s1, const Segment &s2) {
		if(abs(cross(s1.b - s1.a, s2.b - s2.a)) > EPS) return false;
		if(ccw(s1.a, s2.a, s1.b) == 1 || ccw(s1.a, s2.a, s1.b) == -1) return false;
		if(ccw(s1.a, s1.b, s2.a) == -2 || ccw(s2.a, s2.b, s1.a) == -2) return false;
		s1 = Segment(min(s1.a, s2.a), max(s1.b, s2.b));
		return true;
	};

	for(int i = 0; i < segs.size(); i++) {
		if(segs[i].b < segs[i].a) swap(segs[i].a, segs[i].b);
	}
	for(int i = 0; i < segs.size(); i++) {
		for(int j = i + 1; j < segs.size(); j++) {
			if(merge_if_able(segs[i], segs[j])) {
				segs[j--] = segs.back(), segs.pop_back();
			}
		}
	}
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分アレンジメント
// 任意の2線分の交点を頂点としたグラフを構築する
vector<vector<int>> segment_arrangement(vector<Segment> &segs, vector<Point> &ps) {
	vector<vector<int>> g;
	int N = (int)segs.size();
	for(int i = 0; i < N; i++) {
		ps.emplace_back(segs[i].a);
		ps.emplace_back(segs[i].b);
		for(int j = i + 1; j < N; j++) {
			const Point p1 = segs[i].b - segs[i].a;
			const Point p2 = segs[j].b - segs[j].a;
			if(eq(cross(p1, p2), 0)) continue;	// " == 0" となっていたのを訂正
			if(intersect(segs[i], segs[j])) {
				ps.emplace_back(crosspoint(segs[i], segs[j]));
			}
		}
	}
	sort(begin(ps), end(ps));
	ps.erase(unique(begin(ps), end(ps)), end(ps));	// これ誤差とか大丈夫なのか？

	int M = (int)ps.size();
	g.resize(M);
	for(int i = 0; i < N; i++) {
		vector<int> vec;
		for(int j = 0; j < M; j++) {
			if(intersect(segs[i], ps[j])) {
				vec.emplace_back(j);
			}
		}
		for(int j = 1; j < vec.size(); j++) {
			g[vec[j - 1]].push_back(vec[j]);
			g[vec[j]].push_back(vec[j - 1]);
		}
	}
	return (g);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C
// 凸多角形の切断
// 直線 l.a-l.b で切断しその左側にできる凸多角形を返す
Polygon convex_cut(const Polygon &U, Line l) {
	Polygon ret;
	for(int i = 0; i < U.size(); i++) {
		Point now = U[i], nxt = U[(i + 1) % U.size()];
		if(ccw(l.a, l.b, now) != -1) ret.push_back(now);
		if(ccw(l.a, l.b, now) * ccw(l.a, l.b, nxt) < 0) {
			ret.push_back(crosspoint(Line(now, nxt), l));
		}
	}
	return (ret);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A
// 多角形の面積
Real area(const Polygon &p) {
	Real A = 0;
	for(int i = 0; i < p.size(); ++i) {
		A += cross(p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H
// 円と多角形の共通部分の面積
Real area(const Polygon &p, const Circle &c) {
	if(p.size() < 3) return 0.0;
	function<Real(Circle, Point, Point)> cross_area = [&](const Circle &c, const Point &a, const Point &b) {
		Point va = c.p - a, vb = c.p - b;
		Real f = cross(va, vb), ret = 0.0;
		if(eq(f, 0.0)) return ret;
		if(max(abs(va), abs(vb)) < c.r + EPS) return f;
		if(distance(Segment(a, b), c.p) > c.r - EPS) return c.r * c.r * arg(vb * conj(va));	 // 0.5倍してなくない？
		auto u = crosspoint(c, Segment(a, b));
		vector<Point> tot{a, u.first, u.second, b};
		for(int i = 0; i + 1 < tot.size(); i++) {
			ret += cross_area(c, tot[i], tot[i + 1]);
		}
		return ret;
	};
	Real A = 0;
	for(int i = 0; i < p.size(); i++) {
		A += cross_area(c, p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;	 // 0.5倍が抜けていたので修正;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
// 凸多角形の直径(最遠頂点対間距離)
Real convex_diameter(const Polygon &p) {
	int N = (int)p.size();
	int is = 0, js = 0;
	for(int i = 1; i < N; i++) {
		if(p[i].imag() > p[is].imag()) is = i;
		if(p[i].imag() < p[js].imag()) js = i;
	}
	Real maxdis = norm(p[is] - p[js]);

	int maxi, maxj, i, j;
	i = maxi = is;
	j = maxj = js;
	do {
		if(cross(p[(i + 1) % N] - p[i], p[(j + 1) % N] - p[j]) >= 0) {
			j = (j + 1) % N;
		} else {
			i = (i + 1) % N;
		}
		if(norm(p[i] - p[j]) > maxdis) {
			maxdis = norm(p[i] - p[j]);
			maxi = i;
			maxj = j;
		}
	} while(i != is || j != js);
	return sqrt(maxdis);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
// 最近点対
Real closest_pair(Points ps) {
	if(ps.size() <= 1) throw(0);
	sort(begin(ps), end(ps));  // xでソート

	auto compare_y = [&](const Point &a, const Point &b) { return imag(a) < imag(b); };
	vector<Point> beet(ps.size());
	const Real INF = 1e18;

	function<Real(int, int)> rec = [&](int left, int right) {
		if(right - left <= 1) return INF;
		int mid = (left + right) >> 1;
		auto x = real(ps[mid]);	 // 領域内でx座標真中の点
		auto ret = min(rec(left, mid), rec(mid, right));
		// y座標でソートされた2つの区間をマージ
		inplace_merge(begin(ps) + left, begin(ps) + mid, begin(ps) + right, compare_y);
		int ptr = 0;
		for(int i = left; i < right; i++) {
			if(abs(real(ps[i]) - x) >= ret) continue;
			for(int j = 0; j < ptr; j++) {
				auto luz = ps[i] - beet[ptr - j - 1];
				if(imag(luz) >= ret) break;
				ret = min(ret, abs(luz));
			}
			beet[ptr++] = ps[i];
		}
		return ret;
	};
	return rec(0, (int)ps.size());
}

// (aからの距離):(bからの距離) = dist_a : dist_b となる点の集合(円)を返す
Circle Apollonius_Circle(Point a, Point b, Real dist_a, Real dist_b) {
	assert(!eq(dist_a, dist_b));  //同じ場合はbisectionで
	Real asq = dist_a * dist_a, bsq = dist_b * dist_b;
	Point p = (a * bsq - b * asq) * (1 / (bsq - asq));
	Real r = abs(a - b) * dist_a * dist_b / abs(asq - bsq);
	return Circle(p, r);
}

// 二等分線
Line bisection(Point a, Point b) {
	a = (a + b) * 0.5;
	b = rotate(PI / 2, b - a) + a;
	return Line(a, b);
}

#pragma endregion

void sol() {
	int n, w;
	cin >> n >> w;
	if(n + w == 0) exit(0);

	Points p(n);
	vector<Real> h(n);
	for(int i = 0; i < n; i++) cin >> p[i] >> h[i];

	vector<Real> r(n);
	Real lef, dn, up, rig;
	const Real sz = 100.0;

	auto judge = [&](Real sphere) {
		for(int i = 0; i < n; i++) {
			if(h[i] > sphere) {
				r[i] = sphere;
			} else {
				r[i] = sqrt(pow(sphere, 2) - pow(sphere - h[i], 2));
			}
		}
		Real margin = sphere;
		if(sphere > w) {
			margin = sqrt(pow(sphere, 2) - pow(sphere - w, 2));
		}

		lef = margin;
		rig = 100 - margin;
		up = 100 - margin;
		dn = margin;

		auto safe = [&](Real x, Real y) {
			if(x < lef - EPS || x > rig + EPS) return false;
			if(y < dn - EPS || y > up + EPS) return false;

			for(int i = 0; i < n; i++) {
				if(distance(p[i], Point(x, y)) < r[i] - EPS) {
					return false;
				}
			}

			return true;
		};

		auto safepoint = [&](Point p) { return safe(p.real(), p.imag()); };

		if(safe(lef, up) || safe(lef, dn) || safe(rig, up) || safe(rig, dn)) {
			return true;
		}

		Points square(4);
		square[0] = Point(lef, up);
		square[1] = Point(lef, dn);
		square[2] = Point(rig, dn);
		square[3] = Point(rig, up);

		for(int i = 0; i < n; i++)
			for(int j = i + 1; j < n; j++) {
				int is = intersect(Circle(p[i], r[i]), Circle(p[j], r[j]));
				if(is == 4 || is == 0) continue;

				auto pr = crosspoint(Circle(p[i], r[i]), Circle(p[j], r[j]));
				if(safepoint(pr.first) || safepoint(pr.second)) return true;
			}

		for(int i = 0; i < n; i++)
			for(int j = 0; j < 4; j++) {
				if(intersect(Circle(p[i], r[i]), Line(square[j], square[(j + 1) % 4]))) {
					auto pr = (crosspoint(Circle(p[i], r[i]), Line(square[j], square[(j + 1) % 4])));
					if(safepoint(pr.first) || safepoint(pr.second)) return true;
				}
			}

		return false;
	};

	Real ok = 0.0;
	Real ng = 10000000000;
	while(ng - ok > 0.00005) {
		Real med = (ok + ng) / 2;
		if(judge(med)) {
			ok = med;
		} else {
			ng = med;
		}
	}
	cout << ok << '\n';
	return;
}

int main() {
	while(1) sol();
}
accuracy: 1
time_ms: 250
memory_kb: 3824
final_rank: 9

code_snippet: #include <bits/stdc++.h>
using namespace std;

#pragma region geometry

using Real = long double;  //時間がかかる割にdoubleと大差ない
using Point = complex<Real>;
const Real EPS = 1e-10, /*1e-8はたまに落ちる*/ PI = acos(-1);

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }  //誤差無視の等式

//実スカラー倍
Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

// point入力受け取り
istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
// point出力
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// 点 p を反時計回りに theta 回転
Point rotate(Real theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r) { return (r * 180.0 / PI); }

Real degree_to_radian(Real d) { return (d * PI / 180.0); }

// a-b-c の角度のうち小さい方を返す
Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), /* もとはv(b-a)になってたので修正 */ w(c - b);
	Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
	if(alpha > beta) swap(alpha, beta);
	Real theta = (beta - alpha);
	return min(theta, 2 * acos(-1) - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " to " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

//外積
Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
//内積
Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;   // "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;  // "CLOCKWISE"
	if(dot(b, c) < 0) return +2;	   // "ONLINE_BACK"
	if(norm(b) < norm(c)) return -2;   // "ONLINE_FRONT"
	return 0;						   // "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// 射影
// 直線 l に p から垂線を引いた交点を求める
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// 反射
// 直線 l を対称軸として点 p  と線対称にある点を求める
Point reflection(const Line &l, const Point &p) { return p + (projection(l, p) - p) * 2.0; }

bool intersect(const Line &l, const Point &p) { return abs(ccw(l.a, l.b, p)) != 1; }

bool intersect(const Line &l, const Line &m) { return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS; }

bool intersect(const Segment &s, const Point &p) { return ccw(s.a, s.b, p) == 0; }

bool intersect(const Line &l, const Segment &s) { return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS; }

Real distance(const Line &l, const Point &p);

bool intersect(const Circle &c, const Line &l) { return distance(l, c.p) <= c.r + EPS; }

bool intersect(const Circle &c, const Point &p) { return abs(abs(p - c.p) - c.r) < EPS; }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
// 線分同士の交差判定　(端点が他方の線分上にあるならば交差とみなす)
bool intersect(const Segment &s, const Segment &t) {
	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l) {
	if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
	if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
	const Point h = projection(l, c.p);
	if(dot(l.a - h, l.b - h) < 0) return 2;
	return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2) {
	if(c1.r < c2.r) swap(c1, c2);
	Real d = abs(c1.p - c2.p);
	if(c1.r + c2.r < d) return 4;	  // 外に離れている
	if(eq(c1.r + c2.r, d)) return 3;  // 外接
	if(c1.r - c2.r < d) return 2;	  // 交差
	if(eq(c1.r - c2.r, d)) return 1;  // 内接
	return 0;						  // 内包
}

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	if(intersect(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	Point e = (l.b - l.a) / abs(l.b - l.a);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	double base = sqrt(c.r * c.r - norm(pr - c.p));
	return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	Line aa = Line(l.a, l.b);
	if(intersect(c, l) == 2) return crosspoint(c, aa);
	auto ret = crosspoint(c, aa);
	if(dot(l.a - ret.first, l.b - ret.first) < 0)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // 余弦定理
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return {p1, p2};
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Point u = (c2.p - c1.p) / sqrt(g);
	Point v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B
// 凸性判定 (反時計回り)
bool is_convex(const Polygon &p) {
	int n = (int)p.size();
	for(int i = 0; i < n; i++) {
		if(ccw(p[(i + n - 1) % n], p[i], p[(i + 1) % n]) == -1) return false;
	}
	return true;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A
// 凸包
Polygon convex_hull(Polygon &p) {
	int n = (int)p.size(), k = 0;
	if(n <= 2) return p;
	sort(p.begin(), p.end());  // x -> yの順にソート
	vector<Point> ch(2 * n);
	for(int i = 0; i < n; ch[k++] = p[i++]) {  //下半分を構成
		while(k >= 2 && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {  //上半分を構成
		while(k >= t && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	ch.resize(k - 1);
	return ch;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C
// 多角形と点の包含判定
enum { OUT, ON, IN };

int contains(const Polygon &Q, const Point &p) {
	bool in = false;
	for(int i = 0; i < Q.size(); i++) {
		Point a = Q[i] - p, b = Q[(i + 1) % Q.size()] - p;
		if(a.imag() > b.imag()) swap(a, b);
		if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0) in = !in;
		if(cross(a, b) == 0 && dot(a, b) <= 0) return ON;
	}
	return in ? IN : OUT;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分の重複除去
void merge_segments(vector<Segment> &segs) {
	auto merge_if_able = [](Segment &s1, const Segment &s2) {
		if(abs(cross(s1.b - s1.a, s2.b - s2.a)) > EPS) return false;
		if(ccw(s1.a, s2.a, s1.b) == 1 || ccw(s1.a, s2.a, s1.b) == -1) return false;
		if(ccw(s1.a, s1.b, s2.a) == -2 || ccw(s2.a, s2.b, s1.a) == -2) return false;
		s1 = Segment(min(s1.a, s2.a), max(s1.b, s2.b));
		return true;
	};

	for(int i = 0; i < segs.size(); i++) {
		if(segs[i].b < segs[i].a) swap(segs[i].a, segs[i].b);
	}
	for(int i = 0; i < segs.size(); i++) {
		for(int j = i + 1; j < segs.size(); j++) {
			if(merge_if_able(segs[i], segs[j])) {
				segs[j--] = segs.back(), segs.pop_back();
			}
		}
	}
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分アレンジメント
// 任意の2線分の交点を頂点としたグラフを構築する
vector<vector<int>> segment_arrangement(vector<Segment> &segs, vector<Point> &ps) {
	vector<vector<int>> g;
	int N = (int)segs.size();
	for(int i = 0; i < N; i++) {
		ps.emplace_back(segs[i].a);
		ps.emplace_back(segs[i].b);
		for(int j = i + 1; j < N; j++) {
			const Point p1 = segs[i].b - segs[i].a;
			const Point p2 = segs[j].b - segs[j].a;
			if(eq(cross(p1, p2), 0)) continue;	// " == 0" となっていたのを訂正
			if(intersect(segs[i], segs[j])) {
				ps.emplace_back(crosspoint(segs[i], segs[j]));
			}
		}
	}
	sort(begin(ps), end(ps));
	ps.erase(unique(begin(ps), end(ps)), end(ps));	// これ誤差とか大丈夫なのか？

	int M = (int)ps.size();
	g.resize(M);
	for(int i = 0; i < N; i++) {
		vector<int> vec;
		for(int j = 0; j < M; j++) {
			if(intersect(segs[i], ps[j])) {
				vec.emplace_back(j);
			}
		}
		for(int j = 1; j < vec.size(); j++) {
			g[vec[j - 1]].push_back(vec[j]);
			g[vec[j]].push_back(vec[j - 1]);
		}
	}
	return (g);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C
// 凸多角形の切断
// 直線 l.a-l.b で切断しその左側にできる凸多角形を返す
Polygon convex_cut(const Polygon &U, Line l) {
	Polygon ret;
	for(int i = 0; i < U.size(); i++) {
		Point now = U[i], nxt = U[(i + 1) % U.size()];
		if(ccw(l.a, l.b, now) != -1) ret.push_back(now);
		if(ccw(l.a, l.b, now) * ccw(l.a, l.b, nxt) < 0) {
			ret.push_back(crosspoint(Line(now, nxt), l));
		}
	}
	return (ret);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A
// 多角形の面積
Real area(const Polygon &p) {
	Real A = 0;
	for(int i = 0; i < p.size(); ++i) {
		A += cross(p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H
// 円と多角形の共通部分の面積
Real area(const Polygon &p, const Circle &c) {
	if(p.size() < 3) return 0.0;
	function<Real(Circle, Point, Point)> cross_area = [&](const Circle &c, const Point &a, const Point &b) {
		Point va = c.p - a, vb = c.p - b;
		Real f = cross(va, vb), ret = 0.0;
		if(eq(f, 0.0)) return ret;
		if(max(abs(va), abs(vb)) < c.r + EPS) return f;
		if(distance(Segment(a, b), c.p) > c.r - EPS) return c.r * c.r * arg(vb * conj(va));	 // 0.5倍してなくない？
		auto u = crosspoint(c, Segment(a, b));
		vector<Point> tot{a, u.first, u.second, b};
		for(int i = 0; i + 1 < tot.size(); i++) {
			ret += cross_area(c, tot[i], tot[i + 1]);
		}
		return ret;
	};
	Real A = 0;
	for(int i = 0; i < p.size(); i++) {
		A += cross_area(c, p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;	 // 0.5倍が抜けていたので修正;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
// 凸多角形の直径(最遠頂点対間距離)
Real convex_diameter(const Polygon &p) {
	int N = (int)p.size();
	int is = 0, js = 0;
	for(int i = 1; i < N; i++) {
		if(p[i].imag() > p[is].imag()) is = i;
		if(p[i].imag() < p[js].imag()) js = i;
	}
	Real maxdis = norm(p[is] - p[js]);

	int maxi, maxj, i, j;
	i = maxi = is;
	j = maxj = js;
	do {
		if(cross(p[(i + 1) % N] - p[i], p[(j + 1) % N] - p[j]) >= 0) {
			j = (j + 1) % N;
		} else {
			i = (i + 1) % N;
		}
		if(norm(p[i] - p[j]) > maxdis) {
			maxdis = norm(p[i] - p[j]);
			maxi = i;
			maxj = j;
		}
	} while(i != is || j != js);
	return sqrt(maxdis);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
// 最近点対
Real closest_pair(Points ps) {
	if(ps.size() <= 1) throw(0);
	sort(begin(ps), end(ps));  // xでソート

	auto compare_y = [&](const Point &a, const Point &b) { return imag(a) < imag(b); };
	vector<Point> beet(ps.size());
	const Real INF = 1e18;

	function<Real(int, int)> rec = [&](int left, int right) {
		if(right - left <= 1) return INF;
		int mid = (left + right) >> 1;
		auto x = real(ps[mid]);	 // 領域内でx座標真中の点
		auto ret = min(rec(left, mid), rec(mid, right));
		// y座標でソートされた2つの区間をマージ
		inplace_merge(begin(ps) + left, begin(ps) + mid, begin(ps) + right, compare_y);
		int ptr = 0;
		for(int i = left; i < right; i++) {
			if(abs(real(ps[i]) - x) >= ret) continue;
			for(int j = 0; j < ptr; j++) {
				auto luz = ps[i] - beet[ptr - j - 1];
				if(imag(luz) >= ret) break;
				ret = min(ret, abs(luz));
			}
			beet[ptr++] = ps[i];
		}
		return ret;
	};
	return rec(0, (int)ps.size());
}

// (aからの距離):(bからの距離) = dist_a : dist_b となる点の集合(円)を返す
Circle Apollonius_Circle(Point a, Point b, Real dist_a, Real dist_b) {
	assert(!eq(dist_a, dist_b));  //同じ場合はbisectionで
	Real asq = dist_a * dist_a, bsq = dist_b * dist_b;
	Point p = (a * bsq - b * asq) * (1 / (bsq - asq));
	Real r = abs(a - b) * dist_a * dist_b / abs(asq - bsq);
	return Circle(p, r);
}

// 二等分線
Line bisection(Point a, Point b) {
	a = (a + b) * 0.5;
	b = rotate(PI / 2, b - a) + a;
	return Line(a, b);
}

#pragma endregion

using R = Real;

bool left_is_smaller(R left, R right) { return left < right - EPS; }

void sol() {
	int n, w;
	cin >> n >> w;
	if(n + w == 0) exit(0);

	Points p(n);
	vector<Real> h(n);
	for(int i = 0; i < n; i++) cin >> p[i] >> h[i];

	vector<Real> r(n);
	Real lef, dn, up, rig;
	const Real sz = 100.0;

	auto judge = [&](Real sphere) {
		for(int i = 0; i < n; i++) {
			if(h[i] > sphere) {
				r[i] = sphere;
			} else {
				r[i] = sqrt(pow(sphere, 2) - pow(sphere - h[i], 2));
			}
		}
		R margin = sphere;
		if(sphere > w) {
			margin = sqrt(pow(sphere, 2) - pow(sphere - w, 2));
		}

		lef = margin;
		rig = 100 - margin;
		up = 100 - margin;
		dn = margin;

		auto safe = [&](Real x, Real y) {
			if(x < lef - EPS || x > rig + EPS) return false;
			if(y < dn - EPS || y > up + EPS) return false;

			for(int i = 0; i < n; i++) {
				if(distance(p[i], Point(x, y)) < r[i] - EPS) {
					return false;
				}
			}

			return true;
		};

		auto safepoint = [&](Point p) { return safe(p.real(), p.imag()); };

		if(safe(lef, up) || safe(lef, dn) || safe(rig, up) || safe(rig, dn)) {
			return true;
		}

		Points square(4);
		square[0] = Point(lef, up);
		square[1] = Point(lef, dn);
		square[2] = Point(rig, dn);
		square[3] = Point(rig, up);

		for(int i = 0; i < n; i++)
			for(int j = i + 1; j < n; j++) {
				int is = intersect(Circle(p[i], r[i]), Circle(p[j], r[j]));
				if(is == 4 || is == 0) continue;

				auto pr = crosspoint(Circle(p[i], r[i]), Circle(p[j], r[j]));
				if(safepoint(pr.first) || safepoint(pr.second)) return true;
			}

		for(int i = 0; i < n; i++)
			for(int j = 0; j < 4; j++) {
				if(intersect(Circle(p[i], r[i]), Line(square[j], square[(j + 1) % 4]))) {
					auto pr = (crosspoint(Circle(p[i], r[i]), Line(square[j], square[(j + 1) % 4])));
					if(safepoint(pr.first) || safepoint(pr.second)) return true;
				}
			}

		return false;
	};

	R ok = 0.0;
	R ng = 10000000000;
	while(ng - ok > 0.00005) {
		R med = (ok + ng) / 2;
		if(judge(med)) {
			ok = med;
		} else {
			ng = med;
		}
	}
	cout << ok << '\n';
	return;
}

int main() {
	while(1) sol();
}
accuracy: 1
time_ms: 250
memory_kb: 3668
final_rank: 8

code_snippet: /*	author:  Kite_kuma
	created: 2020.12.04 10:47:42 */

// #ifdef LOCAL
// #define _GLIBCXX_DEBUG
// #endif
#include <bits/stdc++.h>
using namespace std;

#pragma region aliases

#define rep(i, n) for(long long i = 0; i < (n); i++)
#define rrep(i, n) for(long long i = (n)-1; i > -1; i--)
#define Rep(i, m, n) for(long long i = (m); i < (n); i++)
#define rRep(i, m, n) for(long long i = (n)-1; i >= (m); i--)
#define REP(i, m, n, p) for(long long i = m; i < n; i += p)
#define foa(s, v) for(auto &s : v)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define bcnt(n) __builtin_popcountll(n)

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
template <class T = ll>
using V = vector<T>;
template <class T = ll>
using VV = V<V<T>>;
template <class T = ll>
using VVV = V<V<V<T>>>;
template <class T = ll>
using pqup = priority_queue<T, vector<T>, greater<T>>;
template <class T = ll>
using pqdn = priority_queue<T>;

#pragma endregion

#pragma region constants

long long const dekai = 1e18;
const long double pi = acos(-1);
const char dl = '\n';
const char sp = ' ';
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

const int mod = 1000000007;
// const int mod = 998244353;

#pragma endregion

#pragma region basic_procedure

template <class T>
inline bool isin(T x, T lef, T rig) {
	return ((lef <= x) && (x < rig));
}

template <class T>
inline bool chmin(T &a, T b) {
	if(a > b) {
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b) {
	if(a < b) {
		a = b;
		return true;
	}
	return false;
}

void Yes(bool f = 1) { cout << (f ? "Yes" : "No") << '\n'; }
void No() { cout << "No\n"; }
void YES(bool f = 1) { cout << (f ? "YES" : "NO") << '\n'; }
void NO() { cout << "NO\n"; }

template <class T>
void drop(T answer) {
	cout << answer << '\n';
	exit(0);
}

void err(bool flag) {
	if(!flag) return;
	cout << -1 << '\n';
	exit(0);
}

template <class T>
void vout(vector<T> const &v, bool tate = 0) {
	if(tate) {
		for(auto const &a : v) {
			cout << a << '\n';
		}
		return;
	}
	for(auto it = v.begin(); it != v.end(); it++) {
		cout << (*it);
		if(it != v.end() - 1) {
			cout << ' ';
		}
	}
	cout << '\n';
	return;
}

inline void print() { cout << '\n'; }
template <class T>
inline void print(T x) {
	cout << x << '\n';
	return;
}
template <typename Head, typename... Tail>
void print(Head H, Tail... T) {
	cout << H << " ";
	print(T...);
}

template <class T>
void add(vector<T> &v, T val) {
	for(auto &a : v) a += val;
	return;
}

template <class T>
T dup(T a, T b) {
	assert(b != 0);
	T x = abs(a);
	T y = abs(b);
	T z = (x + y - 1) / y;
	if((a < 0 && b > 0) || (a > 0 && b < 0))
		return -z;
	else if(a == 0)
		return 0;
	else
		return z;
}

template <class T>
T greatest_lower_multiple(T x, T d) {
	if(d == 0) return 0;
	if(d < 0) d *= -1;
	T y = x % d;
	if(y < 0) y += d;
	return x - y;
}

template <class T>
T least_upper_multiple(T x, T d) {
	return -greatest_lower_multiple(-x, d);
}

long long POW(long long a, long long n) {
	long long res = 1;
	while(n > 0) {
		if(n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

long long modpow(long long a, long long n, long long mod) {	 // a^n mod
	assert(n >= 0);
	if(mod == 1) return 0LL;
	long long res = 1;
	while(n > 0) {
		if(n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// a * x % mod == __gcd(a,mod)なるxを返す
// a が modの倍数でないことが条件
long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while(b) {
		long long t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= mod;
	if(u < 0) u += mod;
	return u;
}

vvll comb(100, vll(100, -1));
long long com(long long n, long long k) {  //普通の二項計数
	assert(n < 100 && k < 100);
	if(n < k || k < 0 || n < 0) return 0;
	if(comb[n][k] != -1) return comb[n][k];
	ll res;
	if(n - k < k)
		res = com(n, n - k);
	else if(k == 0)
		res = 1;
	else
		res = com(n - 1, k - 1) + com(n - 1, k);
	comb[n][k] = res;
	return res;
}

const int MAX = 5100000;  // about 300ms, when MAX = 3*10^7 : 1900ms
long long fac[MAX], finv[MAX], inv[MAX];

void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
long long commod(long long n, long long k) {
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
long long pmod(long long n, long long k) {
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return fac[n] * finv[n - k] % mod;
}
// n個の区別しないボールを区別するk個の箱に入れる方法の総数
long long hmod(long long n, long long k) {	// 重複組み合わせ
	return commod(n + k - 1, n);
}
#pragma endregion

#pragma region input
#define VEC(type, name, size) \
	vector<type> name(size);  \
	INPUT(name)
#define VVEC(type, name, h, w)                     \
	vector<vector<type>> name(h, vector<type>(w)); \
	INPUT(name)
#define INT(...)     \
	int __VA_ARGS__; \
	INPUT(__VA_ARGS__)
#define LL(...)            \
	long long __VA_ARGS__; \
	INPUT(__VA_ARGS__)
#define STR(...)        \
	string __VA_ARGS__; \
	INPUT(__VA_ARGS__)
#define CHAR(...)     \
	char __VA_ARGS__; \
	INPUT(__VA_ARGS__)
#define DOUBLE(...)     \
	double __VA_ARGS__; \
	INPUT(__VA_ARGS__)
#define LD(...)              \
	long double __VA_ARGS__; \
	INPUT(__VA_ARGS__)

template <class T>
void scan(T &a) {
	cin >> a;
}
template <class T>
void scan(vector<T> &a) {
	for(auto &i : a) scan(i);
}
template <class T, class L>
void scan(pair<T, L> &p) {
	scan(p.first);
	scan(p.second);
}
void INPUT() {}
template <class Head, class... Tail>
void INPUT(Head &head, Tail &... tail) {
	scan(head);
	INPUT(tail...);
}

template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
	is >> p.first >> p.second;
	return is;
}
#pragma endregion

#pragma region debug

#pragma region output
template <typename T1, typename T2>
std::ostream &std::operator<<(std::ostream &os, const std::pair<T1, T2> &p) {
	os << p.first << " " << p.second;
	return os;
}
template <class T>
std::ostream &std::operator<<(std::ostream &os, const std::vector<T> &v) {
	for(int i = 0; i < (int)v.size(); i++) {
		if(i) os << " ";
		os << v[i];
	}
	return os;
}
#pragma endregion

#pragma region view

template <typename T>
void view(const T e) {
	std::cerr << e;
}

template <typename T, typename U>
void view(const std::pair<T, U> &p) {
	std::cerr << "(";
	view(p.first);
	std::cerr << ", ";
	view(p.second);
	std::cerr << ")";
}

template <typename T>
void view(const std::set<T> &s) {
	if(s.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(auto &t : s) {
		view(t);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::unordered_set<T> &s) {
	if(s.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(auto &t : s) {
		view(t);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::vector<T> &v) {
	if(v.empty()) {
		std::cerr << "{ }";
		return;
	}
	std::cerr << "{ ";
	for(const auto &e : v) {
		view(e);
		std::cerr << ", ";
	}
	std::cerr << "\b\b }";
}

template <typename T>
void view(const std::vector<std::vector<T>> &vv) {
	std::cerr << "{\n";
	for(const auto &v : vv) {
		std::cerr << "\t";
		view(v);
		std::cerr << '\n';
	}
	std::cerr << "}";
}

template <typename T, typename U>
void view(const std::vector<std::pair<T, U>> &v) {
	std::cerr << "{\n";
	for(const auto &c : v) {
		std::cerr << "\t(";
		view(c.first);
		std::cerr << ", ";
		view(c.second);
		std::cerr << ")\n";
	}
	std::cerr << "}";
}

template <typename T, typename U>
void view(const std::map<T, U> &m) {
	std::cerr << "{\n";
	for(const auto &t : m) {
		std::cerr << "\t[";
		view(t.first);
		std::cerr << "] : ";
		view(t.second);
		std::cerr << '\n';
	}
	std::cerr << "}";
}

template <typename T, typename U>
void view(const std::unordered_map<T, U> &m) {
	std::cerr << "{\n";
	for(const auto &t : m) {
		std::cerr << "\t[";
		view(t.first);
		std::cerr << "] : ";
		view(t.second);
		std::cerr << '\n';
	}
	std::cerr << "}";
}

#pragma endregion

// when debugging : g++ foo.cpp -DLOCAL
#ifdef LOCAL
void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	view(H);
	std::cerr << ", ";
	debug_out(T...);
}
#define debug(...)                                                \
	do {                                                          \
		std::cerr << __LINE__ << " [" << #__VA_ARGS__ << "] : ["; \
		debug_out(__VA_ARGS__);                                   \
		std::cerr << "\b\b]\n";                                   \
	} while(0)
#define dump(x)                                      \
	do {                                             \
		std::cerr << __LINE__ << " " << #x << " : "; \
		view(x);                                     \
		std::cerr << '\n';                           \
	} while(0)

#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

#pragma endregion

#pragma region geometry

using Real = long double;  //時間がかかる割にdoubleと大差ない
using Point = complex<Real>;
const Real EPS = 1e-10, /*1e-8はたまに落ちる*/ PI = acos(-1);

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }  //誤差無視の等式

//実スカラー倍
Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

// point入力受け取り
istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
// point出力
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// 点 p を反時計回りに theta 回転
Point rotate(Real theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r) { return (r * 180.0 / PI); }

Real degree_to_radian(Real d) { return (d * PI / 180.0); }

// a-b-c の角度のうち小さい方を返す
Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), /* もとはv(b-a)になってたので修正 */ w(c - b);
	Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
	if(alpha > beta) swap(alpha, beta);
	Real theta = (beta - alpha);
	return min(theta, 2 * acos(-1) - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " to " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

//外積
Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
//内積
Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;   // "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;  // "CLOCKWISE"
	if(dot(b, c) < 0) return +2;	   // "ONLINE_BACK"
	if(norm(b) < norm(c)) return -2;   // "ONLINE_FRONT"
	return 0;						   // "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// 射影
// 直線 l に p から垂線を引いた交点を求める
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// 反射
// 直線 l を対称軸として点 p  と線対称にある点を求める
Point reflection(const Line &l, const Point &p) { return p + (projection(l, p) - p) * 2.0; }

bool intersect(const Line &l, const Point &p) { return abs(ccw(l.a, l.b, p)) != 1; }

bool intersect(const Line &l, const Line &m) { return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS; }

bool intersect(const Segment &s, const Point &p) { return ccw(s.a, s.b, p) == 0; }

bool intersect(const Line &l, const Segment &s) { return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS; }

Real distance(const Line &l, const Point &p);

bool intersect(const Circle &c, const Line &l) { return distance(l, c.p) <= c.r + EPS; }

bool intersect(const Circle &c, const Point &p) { return abs(abs(p - c.p) - c.r) < EPS; }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
// 線分同士の交差判定　(端点が他方の線分上にあるならば交差とみなす)
bool intersect(const Segment &s, const Segment &t) {
	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l) {
	if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
	if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
	const Point h = projection(l, c.p);
	if(dot(l.a - h, l.b - h) < 0) return 2;
	return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2) {
	if(c1.r < c2.r) swap(c1, c2);
	Real d = abs(c1.p - c2.p);
	if(c1.r + c2.r < d) return 4;	  // 外に離れている
	if(eq(c1.r + c2.r, d)) return 3;  // 外接
	if(c1.r - c2.r < d) return 2;	  // 交差
	if(eq(c1.r - c2.r, d)) return 1;  // 内接
	return 0;						  // 内包
}

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	if(intersect(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	Point e = (l.b - l.a) / abs(l.b - l.a);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	double base = sqrt(c.r * c.r - norm(pr - c.p));
	return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	Line aa = Line(l.a, l.b);
	if(intersect(c, l) == 2) return crosspoint(c, aa);
	auto ret = crosspoint(c, aa);
	if(dot(l.a - ret.first, l.b - ret.first) < 0)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // 余弦定理
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return {p1, p2};
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Point u = (c2.p - c1.p) / sqrt(g);
	Point v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B
// 凸性判定 (反時計回り)
bool is_convex(const Polygon &p) {
	int n = (int)p.size();
	for(int i = 0; i < n; i++) {
		if(ccw(p[(i + n - 1) % n], p[i], p[(i + 1) % n]) == -1) return false;
	}
	return true;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A
// 凸包
Polygon convex_hull(Polygon &p) {
	int n = (int)p.size(), k = 0;
	if(n <= 2) return p;
	sort(p.begin(), p.end());  // x -> yの順にソート
	vector<Point> ch(2 * n);
	for(int i = 0; i < n; ch[k++] = p[i++]) {  //下半分を構成
		while(k >= 2 && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {  //上半分を構成
		while(k >= t && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < EPS) --k;
	}
	ch.resize(k - 1);
	return ch;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C
// 多角形と点の包含判定
enum { OUT, ON, IN };

int contains(const Polygon &Q, const Point &p) {
	bool in = false;
	for(int i = 0; i < Q.size(); i++) {
		Point a = Q[i] - p, b = Q[(i + 1) % Q.size()] - p;
		if(a.imag() > b.imag()) swap(a, b);
		if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0) in = !in;
		if(cross(a, b) == 0 && dot(a, b) <= 0) return ON;
	}
	return in ? IN : OUT;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分の重複除去
void merge_segments(vector<Segment> &segs) {
	auto merge_if_able = [](Segment &s1, const Segment &s2) {
		if(abs(cross(s1.b - s1.a, s2.b - s2.a)) > EPS) return false;
		if(ccw(s1.a, s2.a, s1.b) == 1 || ccw(s1.a, s2.a, s1.b) == -1) return false;
		if(ccw(s1.a, s1.b, s2.a) == -2 || ccw(s2.a, s2.b, s1.a) == -2) return false;
		s1 = Segment(min(s1.a, s2.a), max(s1.b, s2.b));
		return true;
	};

	for(int i = 0; i < segs.size(); i++) {
		if(segs[i].b < segs[i].a) swap(segs[i].a, segs[i].b);
	}
	for(int i = 0; i < segs.size(); i++) {
		for(int j = i + 1; j < segs.size(); j++) {
			if(merge_if_able(segs[i], segs[j])) {
				segs[j--] = segs.back(), segs.pop_back();
			}
		}
	}
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
// 線分アレンジメント
// 任意の2線分の交点を頂点としたグラフを構築する
vector<vector<int>> segment_arrangement(vector<Segment> &segs, vector<Point> &ps) {
	vector<vector<int>> g;
	int N = (int)segs.size();
	for(int i = 0; i < N; i++) {
		ps.emplace_back(segs[i].a);
		ps.emplace_back(segs[i].b);
		for(int j = i + 1; j < N; j++) {
			const Point p1 = segs[i].b - segs[i].a;
			const Point p2 = segs[j].b - segs[j].a;
			if(eq(cross(p1, p2), 0)) continue;	// " == 0" となっていたのを訂正
			if(intersect(segs[i], segs[j])) {
				ps.emplace_back(crosspoint(segs[i], segs[j]));
			}
		}
	}
	sort(begin(ps), end(ps));
	ps.erase(unique(begin(ps), end(ps)), end(ps));	// これ誤差とか大丈夫なのか？

	int M = (int)ps.size();
	g.resize(M);
	for(int i = 0; i < N; i++) {
		vector<int> vec;
		for(int j = 0; j < M; j++) {
			if(intersect(segs[i], ps[j])) {
				vec.emplace_back(j);
			}
		}
		for(int j = 1; j < vec.size(); j++) {
			g[vec[j - 1]].push_back(vec[j]);
			g[vec[j]].push_back(vec[j - 1]);
		}
	}
	return (g);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C
// 凸多角形の切断
// 直線 l.a-l.b で切断しその左側にできる凸多角形を返す
Polygon convex_cut(const Polygon &U, Line l) {
	Polygon ret;
	for(int i = 0; i < U.size(); i++) {
		Point now = U[i], nxt = U[(i + 1) % U.size()];
		if(ccw(l.a, l.b, now) != -1) ret.push_back(now);
		if(ccw(l.a, l.b, now) * ccw(l.a, l.b, nxt) < 0) {
			ret.push_back(crosspoint(Line(now, nxt), l));
		}
	}
	return (ret);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A
// 多角形の面積
Real area(const Polygon &p) {
	Real A = 0;
	for(int i = 0; i < p.size(); ++i) {
		A += cross(p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H
// 円と多角形の共通部分の面積
Real area(const Polygon &p, const Circle &c) {
	if(p.size() < 3) return 0.0;
	function<Real(Circle, Point, Point)> cross_area = [&](const Circle &c, const Point &a, const Point &b) {
		Point va = c.p - a, vb = c.p - b;
		Real f = cross(va, vb), ret = 0.0;
		if(eq(f, 0.0)) return ret;
		if(max(abs(va), abs(vb)) < c.r + EPS) return f;
		if(distance(Segment(a, b), c.p) > c.r - EPS) return c.r * c.r * arg(vb * conj(va));	 // 0.5倍してなくない？
		auto u = crosspoint(c, Segment(a, b));
		vector<Point> tot{a, u.first, u.second, b};
		for(int i = 0; i + 1 < tot.size(); i++) {
			ret += cross_area(c, tot[i], tot[i + 1]);
		}
		return ret;
	};
	Real A = 0;
	for(int i = 0; i < p.size(); i++) {
		A += cross_area(c, p[i], p[(i + 1) % p.size()]);
	}
	return A * 0.5;	 // 0.5倍が抜けていたので修正;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
// 凸多角形の直径(最遠頂点対間距離)
Real convex_diameter(const Polygon &p) {
	int N = (int)p.size();
	int is = 0, js = 0;
	for(int i = 1; i < N; i++) {
		if(p[i].imag() > p[is].imag()) is = i;
		if(p[i].imag() < p[js].imag()) js = i;
	}
	Real maxdis = norm(p[is] - p[js]);

	int maxi, maxj, i, j;
	i = maxi = is;
	j = maxj = js;
	do {
		if(cross(p[(i + 1) % N] - p[i], p[(j + 1) % N] - p[j]) >= 0) {
			j = (j + 1) % N;
		} else {
			i = (i + 1) % N;
		}
		if(norm(p[i] - p[j]) > maxdis) {
			maxdis = norm(p[i] - p[j]);
			maxi = i;
			maxj = j;
		}
	} while(i != is || j != js);
	return sqrt(maxdis);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
// 最近点対
Real closest_pair(Points ps) {
	if(ps.size() <= 1) throw(0);
	sort(begin(ps), end(ps));  // xでソート

	auto compare_y = [&](const Point &a, const Point &b) { return imag(a) < imag(b); };
	vector<Point> beet(ps.size());
	const Real INF = 1e18;

	function<Real(int, int)> rec = [&](int left, int right) {
		if(right - left <= 1) return INF;
		int mid = (left + right) >> 1;
		auto x = real(ps[mid]);	 // 領域内でx座標真中の点
		auto ret = min(rec(left, mid), rec(mid, right));
		// y座標でソートされた2つの区間をマージ
		inplace_merge(begin(ps) + left, begin(ps) + mid, begin(ps) + right, compare_y);
		int ptr = 0;
		for(int i = left; i < right; i++) {
			if(abs(real(ps[i]) - x) >= ret) continue;
			for(int j = 0; j < ptr; j++) {
				auto luz = ps[i] - beet[ptr - j - 1];
				if(imag(luz) >= ret) break;
				ret = min(ret, abs(luz));
			}
			beet[ptr++] = ps[i];
		}
		return ret;
	};
	return rec(0, (int)ps.size());
}

// (aからの距離):(bからの距離) = dist_a : dist_b となる点の集合(円)を返す
Circle Apollonius_Circle(Point a, Point b, Real dist_a, Real dist_b) {
	assert(!eq(dist_a, dist_b));  //同じ場合はbisectionで
	Real asq = dist_a * dist_a, bsq = dist_b * dist_b;
	Point p = (a * bsq - b * asq) * (1 / (bsq - asq));
	Real r = abs(a - b) * dist_a * dist_b / abs(asq - bsq);
	return Circle(p, r);
}

// 二等分線
Line bisection(Point a, Point b) {
	a = (a + b) * 0.5;
	b = rotate(PI / 2, b - a) + a;
	return Line(a, b);
}

#pragma endregion

using R = Real;

bool left_is_smaller(R left, R right) { return left < right - EPS; }

void sol() {
	int n, w;
	cin >> n >> w;
	if(n + w == 0) exit(0);

	Points p(n);
	V<Real> h(n);
	rep(i, n) cin >> p[i] >> h[i];

	V<Real> r(n);
	Real lef, dn, up, rig;
	const Real sz = 100.0;

	auto judge = [&](Real sphere) {
		rep(i, n) {
			if(h[i] > sphere) {
				r[i] = sphere;
			} else {
				r[i] = sqrt(pow(sphere, 2) - pow(sphere - h[i], 2));
			}
		}
		R margin = sphere;
		if(sphere > w) {
			margin = sqrt(pow(sphere, 2) - pow(sphere - w, 2));
		}

		lef = margin;
		rig = 100 - margin;
		up = 100 - margin;
		dn = margin;

		auto safe = [&](Real x, Real y) {
			if(x < lef - EPS || x > rig + EPS) return false;
			if(y < dn - EPS || y > up + EPS) return false;

			rep(i, n) {
				if(distance(p[i], Point(x, y)) < r[i] - EPS) {
					return false;
				}
			}

			return true;
		};

		auto safepoint = [&](Point p) { return safe(p.real(), p.imag()); };

		if(safe(lef, up) || safe(lef, dn) || safe(rig, up) || safe(rig, dn)) {
			return true;
		}

		Points square(4);
		square[0] = Point(lef, up);
		square[1] = Point(lef, dn);
		square[2] = Point(rig, dn);
		square[3] = Point(rig, up);

		rep(i, n) Rep(j, i + 1, n) {
			int is = intersect(Circle(p[i], r[i]), Circle(p[j], r[j]));
			if(is == 4 || is == 0) continue;

			auto pr = crosspoint(Circle(p[i], r[i]), Circle(p[j], r[j]));
			if(safepoint(pr.first) || safepoint(pr.second)) return true;
		}

		rep(i, n) rep(j, 4) {
			if(intersect(Circle(p[i], r[i]), Line(square[j], square[(j + 1) % 4]))) {
				auto pr = (crosspoint(Circle(p[i], r[i]), Line(square[j], square[(j + 1) % 4])));
				if(safepoint(pr.first) || safepoint(pr.second)) return true;
			}
		}

		return false;
	};

	R ok = 0.0;
	R ng = 10000000000;
	rep(_, 1000) {
		R med = (ok + ng) / 2;
		if(judge(med)) {
			ok = med;
		} else {
			ng = med;
		}
	}
	cout << ok << dl;
	return;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(15);
	srand((unsigned)time(NULL));

	while(1) sol();

	return 0;
}
accuracy: 1
time_ms: 6980
memory_kb: 3924
final_rank: 20

code_snippet: #include <bits/stdc++.h>
using namespace std;

using Real = double;  //時間がかかる割にdoubleと大差ない
using Point = complex<Real>;
const Real EPS = 1e-12, /*1e-8はたまに落ちる*/ PI = acos(-1);

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }  //誤差無視の等式

//実スカラー倍
Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

// point入力受け取り
istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
// point出力
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// 点 p を反時計回りに theta 回転
Point rotate(Real theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r) { return (r * 180.0 / PI); }

Real degree_to_radian(Real d) { return (d * PI / 180.0); }

// a-b-c の角度のうち小さい方を返す
Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), /* もとはv(b-a)になってたので修正 */ w(c - b);
	Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
	if(alpha > beta) swap(alpha, beta);
	Real theta = (beta - alpha);
	return min(theta, 2 * acos(-1) - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " to " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

//外積
Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
//内積
Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;   // "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;  // "CLOCKWISE"
	if(dot(b, c) < 0) return +2;       // "ONLINE_BACK"
	if(norm(b) < norm(c)) return -2;   // "ONLINE_FRONT"
	return 0;                          // "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// 射影
// 直線 l に p から垂線を引いた交点を求める
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// 反射
// 直線 l を対称軸として点 p  と線対称にある点を求める
Point reflection(const Line &l, const Point &p) { return p + (projection(l, p) - p) * 2.0; }

bool intersect(const Line &l, const Point &p) { return abs(ccw(l.a, l.b, p)) != 1; }

bool intersect(const Line &l, const Line &m) { return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS; }

bool intersect(const Segment &s, const Point &p) { return ccw(s.a, s.b, p) == 0; }

bool intersect(const Line &l, const Segment &s) { return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS; }

Real distance(const Line &l, const Point &p);

bool intersect(const Circle &c, const Line &l) { return distance(l, c.p) <= c.r + EPS; }

bool intersect(const Circle &c, const Point &p) { return abs(abs(p - c.p) - c.r) < EPS; }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
// 線分同士の交差判定　(端点が他方の線分上にあるならば交差とみなす)
bool intersect(const Segment &s, const Segment &t) {
	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l) {
	if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
	if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
	const Point h = projection(l, c.p);
	if(dot(l.a - h, l.b - h) < 0) return 2;
	return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2) {
	if(c1.r < c2.r) swap(c1, c2);
	Real d = abs(c1.p - c2.p);
	if(c1.r + c2.r < d) return 0;     // 外に離れている
	if(eq(c1.r + c2.r, d)) return 3;  // 外接
	if(c1.r - c2.r < d) return 2;     // 交差
	if(eq(c1.r - c2.r, d)) return 1;  // 内接
	return 0;                         // 内包
}

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	if(intersect(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	Point e = (l.b - l.a) / abs(l.b - l.a);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	double base = sqrt(c.r * c.r - norm(pr - c.p));
	return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	Line aa = Line(l.a, l.b);
	if(intersect(c, l) == 2) return crosspoint(c, aa);
	auto ret = crosspoint(c, aa);
	if(dot(l.a - ret.first, l.b - ret.first) < 0)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // 余弦定理
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return {p1, p2};
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Point u = (c2.p - c1.p) / sqrt(g);
	Point v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}

void solve() {
	int n, m;
	cin >> n >> m;
	if(!n) exit(0);

	Points p(n);
	vector<Real> h(n);
	//input
	for(int i = 0; i < n; i++)
		cin >> p[i] >> h[i];

	//二分探索の判定関数
	auto judge = [&](Real rad) {
		//確実に置けない円
		Circles Cir(n);
		for(int i = 0; i < n; i++) {
			if(h[i] >= rad)
				Cir[i].r = rad;
			else
				Cir[i].r = sqrt(h[i] * rad * 2 - h[i] * h[i]);
			Cir[i].p = p[i];
		}

		Real blank = (m >= rad ? rad : sqrt(m * rad * 2 - m * m));

		if(blank > 50) return false;

		Point a = {blank, blank}, b = {blank, 100 - blank}, c = {100 - blank, 100 - blank}, d = {100 - blank, blank};

		Segments SEG = {Segment(a, b), Segment(b, c), Segment(c, d), Segment(d, a)};

		Points candidate = {a, b, c, d};

		for(int i = 0; i < n; i++) {
			//円同士の交点を全列挙
			for(int j = i + 1; j < n; j++) {
				if(intersect(Cir[i], Cir[j])) {
					auto [p1, p2] = crosspoint(Cir[i], Cir[j]);
					candidate.push_back(p1);
					candidate.push_back(p2);
				}
			}
			//円と正方形の交点を全列挙
			for(int j = 0; j < 4; j++) {
				if(intersect(Cir[i], SEG[j])) {
					auto [p1, p2] = crosspoint(Cir[i], SEG[j]);
					candidate.push_back(p1);
					candidate.push_back(p2);
				}
			}
		}

		auto satisfied = [&](Point p) {
			for(auto c : Cir) {
				if(distance(p, c.p) + EPS < c.r) return false;
			}
			if(p.real() + EPS < blank) return false;
			if(p.imag() + EPS < blank) return false;
			if(p.real() - EPS > 100 - blank) return false;
			if(p.imag() - EPS > 100 - blank) return false;
			return true;
		};

		for(auto &p : candidate) 
			if(satisfied(p)) return true;
		
		return false;
	};

	Real ok = 0, ng = 200;
	for(int i = 0; i < 25; i++) {
		Real mid = (ok + ng) / 2;
		if(judge(mid))
			ok = mid;
		else
			ng = mid;
	}
	cout << ok << '\n';
	return;
}

int main() {
	cout << fixed << setprecision(15);
	while(1) solve();
}
accuracy: 1
time_ms: 80
memory_kb: 4076
final_rank: 15

code_snippet: #include <bits/stdc++.h>
using namespace std;

using Real = double;  //時間がかかる割にdoubleと大差ない
using Point = complex<Real>;
const Real EPS = 1e-12, /*1e-8はたまに落ちる*/ PI = acos(-1);

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }  //誤差無視の等式

//実スカラー倍
Point operator*(const Point &p, const Real &d) { return Point(real(p) * d, imag(p) * d); }

// point入力受け取り
istream &operator>>(istream &is, Point &p) {
	Real a, b;
	is >> a >> b;
	p = Point(a, b);
	return is;
}
// point出力
ostream &operator<<(ostream &os, Point &p) { return os << fixed << setprecision(10) << p.real() << " " << p.imag(); }

// 点 p を反時計回りに theta 回転
Point rotate(Real theta, const Point &p) {
	return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r) { return (r * 180.0 / PI); }

Real degree_to_radian(Real d) { return (d * PI / 180.0); }

// a-b-c の角度のうち小さい方を返す
Real get_angle(const Point &a, const Point &b, const Point &c) {
	const Point v(a - b), /* もとはv(b-a)になってたので修正 */ w(c - b);
	Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
	if(alpha > beta) swap(alpha, beta);
	Real theta = (beta - alpha);
	return min(theta, 2 * acos(-1) - theta);
}

namespace std {
bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); }
}  // namespace std

struct Line {
	Point a, b;

	Line() = default;

	Line(Point a, Point b) : a(a), b(b) {}

	Line(Real A, Real B, Real C)  // Ax + By = C
	{
		if(eq(A, 0))
			a = Point(0, C / B), b = Point(1, C / B);
		else if(eq(B, 0))
			b = Point(C / A, 0), b = Point(C / A, 1);
		else
			a = Point(0, C / B), b = Point(C / A, 0);
	}

	friend ostream &operator<<(ostream &os, Line &p) { return os << p.a << " to " << p.b; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a >> a.b; }
};

struct Segment : Line {
	Segment() = default;

	Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
	Point p;
	Real r;

	Circle() = default;

	Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

//外積
Real cross(const Point &a, const Point &b) { return real(a) * imag(b) - imag(a) * real(b); }
//内積
Real dot(const Point &a, const Point &b) { return real(a) * real(b) + imag(a) * imag(b); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c) {
	b = b - a, c = c - a;
	if(cross(b, c) > EPS) return +1;   // "COUNTER_CLOCKWISE"
	if(cross(b, c) < -EPS) return -1;  // "CLOCKWISE"
	if(dot(b, c) < 0) return +2;       // "ONLINE_BACK"
	if(norm(b) < norm(c)) return -2;   // "ONLINE_FRONT"
	return 0;                          // "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
bool parallel(const Line &a, const Line &b) { return eq(cross(a.b - a.a, b.b - b.a), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
bool orthogonal(const Line &a, const Line &b) { return eq(dot(a.a - a.b, b.a - b.b), 0.0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// 射影
// 直線 l に p から垂線を引いた交点を求める
Point projection(const Line &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
	double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// 反射
// 直線 l を対称軸として点 p  と線対称にある点を求める
Point reflection(const Line &l, const Point &p) { return p + (projection(l, p) - p) * 2.0; }

bool intersect(const Line &l, const Point &p) { return abs(ccw(l.a, l.b, p)) != 1; }

bool intersect(const Line &l, const Line &m) { return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS; }

bool intersect(const Segment &s, const Point &p) { return ccw(s.a, s.b, p) == 0; }

bool intersect(const Line &l, const Segment &s) { return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS; }

Real distance(const Line &l, const Point &p);

bool intersect(const Circle &c, const Line &l) { return distance(l, c.p) <= c.r + EPS; }

bool intersect(const Circle &c, const Point &p) { return abs(abs(p - c.p) - c.r) < EPS; }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
// 線分同士の交差判定　(端点が他方の線分上にあるならば交差とみなす)
bool intersect(const Segment &s, const Segment &t) {
	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l) {
	if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
	auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
	if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
	if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
	const Point h = projection(l, c.p);
	if(dot(l.a - h, l.b - h) < 0) return 2;
	return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2) {
	if(c1.r < c2.r) swap(c1, c2);
	Real d = abs(c1.p - c2.p);
	if(c1.r + c2.r < d) return 0;     // 外に離れている
	if(eq(c1.r + c2.r, d)) return 3;  // 外接
	if(c1.r - c2.r < d) return 2;     // 交差
	if(eq(c1.r - c2.r, d)) return 1;  // 内接
	return 0;                         // 内包
}

Real distance(const Point &a, const Point &b) { return abs(a - b); }

Real distance(const Line &l, const Point &p) { return abs(p - projection(l, p)); }

Real distance(const Line &l, const Line &m) { return intersect(l, m) ? 0 : distance(l, m.a); }

Real distance(const Segment &s, const Point &p) {
	Point r = projection(s, p);
	if(intersect(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
	if(intersect(a, b)) return 0;
	return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
	if(intersect(l, s)) return 0;
	return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
	Real A = cross(l.b - l.a, m.b - m.a);
	Real B = cross(l.b - l.a, l.b - m.a);
	if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l) {
	Point pr = projection(l, c.p);
	Point e = (l.b - l.a) / abs(l.b - l.a);
	if(eq(distance(l, c.p), c.r)) return {pr, pr};
	double base = sqrt(c.r * c.r - norm(pr - c.p));
	return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l) {
	Line aa = Line(l.a, l.b);
	if(intersect(c, l) == 2) return crosspoint(c, aa);
	auto ret = crosspoint(c, aa);
	if(dot(l.a - ret.first, l.b - ret.first) < 0)
		ret.second = ret.first;
	else
		ret.first = ret.second;
	return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
	Real d = abs(c1.p - c2.p);
	Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));  // 余弦定理
	Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
	Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
	Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
	return {p1, p2};
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
// "点 p を通る円 c の接線"の接点2つ
pair<Point, Point> tangent(const Circle &c1, const Point &p2) { return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r))); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
// 円 c1, c2 の共通接線
Lines tangent(Circle c1, Circle c2) {
	Lines ret;
	if(c1.r < c2.r) swap(c1, c2);
	Real g = norm(c1.p - c2.p);
	if(eq(g, 0)) return ret;
	Point u = (c2.p - c1.p) / sqrt(g);
	Point v = rotate(PI * 0.5, u);
	for(int s : {-1, 1}) {
		Real h = (c1.r + s * c2.r) / sqrt(g);
		if(eq(1 - h * h, 0)) {
			ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
		} else if(1 - h * h > 0) {
			Point uu = u * h, vv = v * sqrt(1 - h * h);
			ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
			ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
		}
	}
	return ret;
}

void solve() {
	int n, m;
	cin >> n >> m;
	if(!n) exit(0);
	Points p(n);
	vector<Real> h(n);
	for(int i = 0; i < n; i++)
		cin >> p[i] >> h[i];

	auto judge = [&](Real rad) {
		Circles Cir(n);
		for(int i = 0; i < n; i++) {
			if(h[i] >= rad)
				Cir[i].r = rad;
			else
				Cir[i].r = sqrt(h[i] * rad * 2 - h[i] * h[i]);
			Cir[i].p = p[i];
		}

		Real blank = (m >= rad ? rad : sqrt(m * rad * 2 - m * m));

		if(blank > 50) return false;

		Point a = {blank, blank}, b = {blank, 100 - blank}, c = {100 - blank, 100 - blank}, d = {100 - blank, blank};

		Segments SEG = {Segment(a, b), Segment(b, c), Segment(c, d), Segment(d, a)};

		Points candidate = {a, b, c, d};

		for(int i = 0; i < n; i++) {
			//円同士の交点を全列挙
			for(int j = i + 1; j < n; j++) {
				if(intersect(Cir[i], Cir[j])) {
					auto [p1, p2] = crosspoint(Cir[i], Cir[j]);
					candidate.push_back(p1);
					candidate.push_back(p2);
				}
			}
			//円と正方形の交点を全列挙
			for(int j = 0; j < 4; j++) {
				if(intersect(Cir[i], SEG[j])) {
					auto [p1, p2] = crosspoint(Cir[i], SEG[j]);
					candidate.push_back(p1);
					candidate.push_back(p2);
				}
			}
		}

		auto satisfied = [&](Point p) {
			for(auto c : Cir) {
				if(distance(p, c.p) + EPS < c.r) return false;
			}
			if(p.real() + EPS < blank) return false;
			if(p.imag() + EPS < blank) return false;
			if(p.real() - EPS > 100 - blank) return false;
			if(p.imag() - EPS > 100 - blank) return false;
			return true;
		};

		for(auto &p : candidate) {
			if(satisfied(p)) return true;
		}

		return false;
	};

	Real ok = 0, ng = 300;
	for(int i = 0; i < 50; i++) {
		Real mid = (ok + ng) / 2;
		if(judge(mid))
			ok = mid;
		else
			ng = mid;
	}
	cout << ok << '\n';
	return;
}

int main() {
	cout << fixed << setprecision(15);
	while(1) solve();
}
accuracy: 1
time_ms: 150
memory_kb: 3956
final_rank: 11

code_snippet: #line 1 "a.cpp"
using namespace std;
#line 1 "/home/kotatsugame/library/math/point.cpp"
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
const double EPS=1e-10;
bool eq(double a,double b){return abs(a-b)<EPS;}
struct Point{
	double x,y;
	Point(double x_=0,double y_=0):x(x_),y(y_){}
	Point operator-()const{return Point(-x,-y);}
	Point operator+(const Point&p)const{return Point(x+p.x,y+p.y);}
	Point operator-(const Point&p)const{return Point(x-p.x,y-p.y);}
	Point operator*(const double k)const{return Point(x*k,y*k);}
	Point operator/(const double k)const{return Point(x/k,y/k);}
	bool operator<(const Point&p)const{return eq(x,p.x)?y<p.y:x<p.x;}
	bool operator==(const Point&p)const{return eq(x,p.x)&&eq(y,p.y);}
};
istream&operator>>(istream&is,Point&p){return is>>p.x>>p.y;}
ostream&operator<<(ostream&os,const Point&p){return os<<fixed<<setprecision(9)<<p.x<<' '<<p.y;}
struct Line{
	Point p1,p2;
	Line(Point p1_=Point(),Point p2_=Point()):p1(p1_),p2(p2_){}
};
struct Segment:Line{
	Segment(Point p1_=Point(),Point p2_=Point()):Line(p1_,p2_){}
};
struct Circle{
	Point o;
	double r;
	Circle(Point o_=Point(),double r_=0):o(o_),r(r_){}
};
using Polygon=vector<Point>;
//function list begin
Point vec(const Line&);
double norm(const Point&);
double norm(const Line&);
double abs(const Point&);
double abs(const Line&);
double arg(const Point&);
double arg(const Line&);
double arg(const Point&,const Point&,const Point&);//a->b->c
int argtype(const Point&);//(-pi,0]->0,(0,pi]->1
bool argless(const Point&,const Point&);//sorting points with arg
double dot(const Point&,const Point&);
double cross(const Point&,const Point&);
Point polar(const double,const double);
Point rotate(const Point&,const double);
enum{ONLINE_FRONT=-2,CLOCKWISE=-1,ON_SEGMENT=0,COUNTER_CLOCKWISE=1,ONLINE_BACK=2};
int ccw(const Point&,const Point&);
int ccw(const Point&,const Point&,const Point&);
int ccw(const Line&,const Point&);
bool orthogonal(const Point&,const Point&);
bool orthogonal(const Line&,const Line&);
bool parallel(const Point&,const Point&);
bool parallel(const Line&,const Line&);
bool intersect(const Line&,const Point&);
bool intersect(const Line&,const Line&);
bool intersect(const Segment&,const Point&);
bool intersect(const Segment&,const Segment&);
bool intersect(const Line&,const Segment&);
bool intersect(const Segment&,const Line&);
bool intersect(const Circle&,const Point&);
int intersect(const Circle&,const Line&);//count contacts
int intersect(const Circle&,const Segment&);
int intersect(const Circle&,const Circle&);//count common tangents
double distance(const Point&,const Point&);
double distance(const Line&,const Point&);
double distance(const Line&,const Line&);
double distance(const Segment&,const Point&);
double distance(const Segment&,const Segment&);
double distance(const Line&,const Segment&);
double distance(const Segment&,const Line&);
double distance(const Circle&,const Point&);
double distance(const Circle&,const Line&);
double distance(const Circle&,const Segment&);
double distance(const Circle&,const Circle&);
Point projection(const Line&,const Point&);
Point reflection(const Line&,const Point&);
Point crosspoint(const Line&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Segment&);
pair<Point,Point>crosspoint(const Circle&,const Circle&);
pair<Point,Point>tangent(const Circle&,const Point&);
vector<Line>tangent(const Circle&,const Circle&);
bool is_convex(const Polygon&);
Polygon convex_hull(Polygon,bool=false);
enum{OUT,ON,IN};
int contain(const Polygon&,const Point&);
int contain(const Circle&,const Point&);
int contain(const Circle&,const Segment&);
Polygon convex_cut(const Polygon&,const Line&);
double diameter(Polygon);
double area(const Polygon&);
double area(const Polygon&,const Line&);
double area(const Polygon&,const Circle&);
//function list end
Point vec(const Line&s){return s.p2-s.p1;}
double norm(const Point&p){return p.x*p.x+p.y*p.y;}
double norm(const Line&s){return norm(vec(s));}
double abs(const Point&p){return hypot(p.x,p.y);}
double abs(const Line&s){return abs(vec(s));}
double arg(const Point&p){return atan2(p.y,p.x);}
double arg(const Line&s){return arg(vec(s));}
double arg(const Point&a,const Point&b,const Point&c){
	double A=arg(b-a),B=arg(c-b);
	double theta=abs(A-B);
	return min(theta,2*M_PI-theta);
}
int argtype(const Point&a)
{
	return a.y<-EPS?0:a.y>EPS?1:a.x<0?1:0;
}
bool argless(const Point&a,const Point&b)
{
	int at=argtype(a),bt=argtype(b);
	return at!=bt?at<bt:ccw(a,b)>0;
}
double dot(const Point&a,const Point&b){return a.x*b.x+a.y*b.y;}
double cross(const Point&a,const Point&b){return a.x*b.y-a.y*b.x;}
Point polar(const double r,const double theta){return Point(cos(theta),sin(theta))*r;}
Point rotate(const Point&p,const double theta){
	return Point(p.x*cos(theta)-p.y*sin(theta),p.x*sin(theta)+p.y*cos(theta));
}
int ccw(const Point&a,const Point&b)
{
	return cross(a,b)>EPS?COUNTER_CLOCKWISE
		:cross(a,b)<-EPS?CLOCKWISE
		:dot(a,b)<0?ONLINE_BACK
		:norm(a)<norm(b)?ONLINE_FRONT
		:ON_SEGMENT;
}
int ccw(const Point&a,const Point&b,const Point&c){return ccw(b-a,c-a);}
int ccw(const Line&s,const Point&p){return ccw(s.p1,s.p2,p);}
bool orthogonal(const Point&a,const Point&b){return eq(dot(a,b),0);}
bool orthogonal(const Line&s,const Line&t){return orthogonal(vec(s),vec(t));}
bool parallel(const Point&a,const Point&b){return eq(cross(a,b),0);}
bool parallel(const Line&s,const Line&t){return parallel(vec(s),vec(t));}
bool intersect(const Line&s,const Point&p){return eq(cross(vec(s),p-s.p1),0);}
bool intersect(const Line&s,const Line&t){return !parallel(s,t)||intersect(s,t.p1);}
bool intersect(const Segment&s,const Point&p){return ccw(s,p)==ON_SEGMENT;}
bool intersect(const Segment&s,const Segment&t){
	return ccw(s,t.p1)*ccw(s,t.p2)<=0&&ccw(t,s.p1)*ccw(t,s.p2)<=0;
}
bool intersect(const Line&s,const Segment&t){
	return cross(vec(s),t.p1-s.p1)*cross(vec(s),t.p2-s.p1)<EPS;
}
bool intersect(const Segment&s,const Line&t){return intersect(t,s);}
bool intersect(const Circle&c,const Point&p){return eq(distance(c.o,p),c.r);}
int intersect(const Circle&c,const Line&s){
	double d=distance(s,c.o);
	return eq(d,c.r)?1:d<c.r?2:0;
}
int intersect(const Circle&c,const Segment&s){
	Point h=projection(s,c.o);
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return distance(c.o,h)>c.r+EPS?0
		:d1<c.r-EPS&&d2<c.r-EPS?0
		:d1<c.r-EPS&&d2>c.r-EPS||d1>c.r-EPS&&d2<c.r-EPS?1
		:intersect(s,h)?eq(distance(c.o,h),c.r)?1:2
		:0;
}
int intersect(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	return eq(d,a.r+b.r)?3:d>a.r+b.r?4:eq(d,abs(a.r-b.r))?1:d>abs(a.r-b.r)?2:0;
}
double distance(const Point&a,const Point&b){return abs(a-b);}
double distance(const Line&s,const Point&p){return distance(p,projection(s,p));}
double distance(const Line&s,const Line&t){return intersect(s,t)?0:distance(s,t.p1);}
double distance(const Segment&s,const Point&p){
	return distance(p,
		dot(vec(s),p-s.p1)<0?s.p1
		:dot(-vec(s),p-s.p2)<0?s.p2
		:projection(s,p)
	);
}
double distance(const Segment&s,const Segment&t){
	return intersect(s,t)?0:min({
		distance(s,t.p1),distance(s,t.p2),
		distance(t,s.p1),distance(t,s.p2)
	});
}
double distance(const Line&s,const Segment&t){
	return intersect(s,t)?0:min(distance(s,t.p1),distance(s,t.p2));
}
double distance(const Segment&s,const Line&t){return distance(t,s);}
double distance(const Circle&c,const Point&p){return abs(distance(c.o,p)-c.r);}
double distance(const Circle&c,const Line&s){return max(distance(s,c.o)-c.r,0.);}
double distance(const Circle&c,const Segment&s){
	return intersect(c,s)?0
		:contain(c,s)?c.r-max(distance(c.o,s.p1),distance(c.o,s.p2))
		:distance(s,c.o)-c.r;
}
double distance(const Circle&a,const Circle&b){return max(distance(a.o,b.o)-a.r-b.r,0.);}
Point projection(const Line&s,const Point&p){
	return s.p1+vec(s)*dot(p-s.p1,vec(s))/norm(s);
}
Point reflection(const Line&s,const Point&p){return projection(s,p)*2-p;}
Point crosspoint(const Line&s,const Line&t){
	double d1=cross(vec(s),t.p1-s.p1);
	double d2=-cross(vec(s),t.p2-s.p1);
	return t.p1+vec(t)*(d1/(d1+d2));
}
pair<Point,Point>crosspoint(const Circle&c,const Line&s){
	Point h=projection(s,c.o);
	Point e=vec(s)/abs(s)*sqrt(c.r*c.r-norm(h-c.o));
	return minmax(h-e,h+e);
}
pair<Point,Point>crosspoint(const Circle&c,const Segment&s){
	pair<Point,Point>p=crosspoint(c,Line(s));
	return intersect(c,s)==2?p
		:intersect(s,p.first)?make_pair(p.first,p.first)
		:make_pair(p.second,p.second);
}
pair<Point,Point>crosspoint(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	double alpha=acos((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d));
	double theta=arg(b.o-a.o);
	return minmax(a.o+polar(a.r,theta+alpha),a.o+polar(a.r,theta-alpha));
}
pair<Point,Point>tangent(const Circle&c,const Point&p){
	return crosspoint(c,Circle(p,sqrt(norm(c.o-p)-c.r*c.r)));
}
vector<Line>tangent(const Circle&a,const Circle&b){
	vector<Line>ret;
	double g=distance(a.o,b.o);
	if(eq(g,0))return ret;
	Point u=(b.o-a.o)/g;
	Point v=rotate(u,M_PI/2);
	for(int s:{-1,1}){
		double h=(a.r+b.r*s)/g;
		if(eq(h*h,1))ret.emplace_back(a.o+(h>0?u:-u)*a.r,a.o+(h>0?u:-u)*a.r+v);
		else if(1-h*h>0){
			Point U=u*h,V=v*sqrt(1-h*h);
			ret.emplace_back(a.o+(U+V)*a.r,b.o-(U+V)*b.r*s);
			ret.emplace_back(a.o+(U-V)*a.r,b.o-(U-V)*b.r*s);
		}
	}
	return ret;
}
bool is_convex(const Polygon&P){
	for(int i=0;i<P.size();i++)
		if(ccw(P[i],P[(i+1)%P.size()],P[(i+2)%P.size()])==CLOCKWISE)return false;
	return true;
}
Polygon convex_hull(Polygon P,bool ONSEG){
	if(P.size()<=2)return P;
	sort(P.begin(),P.end());
	Polygon ret(2*P.size());
	int k=0,t;
	if(ONSEG){
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)==CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])==CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	else{
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)!=COUNTER_CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])!=COUNTER_CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	ret.resize(k-1);
	int mi=0;
	for(int i=1;i<k-1;i++)
		if(eq(ret[mi].y,ret[i].y)?ret[mi].x>ret[i].x:ret[mi].y>ret[i].y)mi=i;
	rotate(ret.begin(),ret.begin()+mi,ret.end());
	return ret;
}
int contain(const Polygon&P,const Point&p){
	bool in=false;
	for(int i=0;i<P.size();i++){
		Segment s(P[i],P[(i+1)%P.size()]);
		if(intersect(s,p))return ON;
		else{
			Point a=s.p1-p,b=s.p2-p;
			if(a.y>b.y)swap(a,b);
			if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS)in=!in;
		}
	}
	return in?IN:OUT;
}
int contain(const Circle&c,const Point&p){
	double d=distance(c.o,p);
	return eq(d,c.r)?ON:d<c.r?IN:OUT;
}
int contain(const Circle&c,const Segment&s){
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return d1<c.r+EPS&&d2<c.r+EPS?eq(d1,c.r)||eq(d2,c.r)?ON:IN:OUT;
}
Polygon convex_cut(const Polygon&P,const Line&s){
	Polygon ret;
	for(int i=0;i<P.size();i++){
		Segment t(P[i],P[(i+1)%P.size()]);
		if(ccw(s,t.p1)!=CLOCKWISE)ret.push_back(t.p1);
		if(!parallel(s,t)&&!intersect(s,t.p1)
			&&!intersect(s,t.p2)&&intersect(s,t))ret.push_back(crosspoint(s,t));
	}
	return ret;
}
double diameter(Polygon P){
	if(!is_convex(P))P=convex_hull(P);
	int mi=0,Mi=0;
	for(int i=1;i<P.size();i++){
		if(P[i].x<P[mi].x)mi=i;
		if(P[i].x>P[Mi].x)Mi=i;
	}
	double ret=0;
	int sm=mi,sM=Mi;
	while(mi!=sM||Mi!=sm){
		ret=max(ret,norm(P[mi]-P[Mi]));
		if(cross(P[(mi+1)%P.size()]-P[mi],P[(Mi+1)%P.size()]-P[Mi])<0)mi=(mi+1)%P.size();
		else Mi=(Mi+1)%P.size();
	}
	return sqrt(ret);
}
double area(const Polygon&P){
	double ret=0;
	for(int i=0;i<P.size();i++)ret+=cross(P[i],P[(i+1)%P.size()]);
	return ret/2;
}
double area(const Polygon&P,const Line&s){return area(convex_cut(P,s));}
double area(const Polygon&P,const Circle&c){
	double ret=0;
	for(int i=0;i<P.size();i++)
	{
		Segment s(P[i],P[(i+1)%P.size()]);
		if(contain(c,s))ret+=cross(s.p1-c.o,s.p2-c.o);
		else if(!intersect(c,s)){
			double a=arg(s.p2-c.o)-arg(s.p1-c.o);
			if(a>M_PI)a-=2*M_PI;
			if(a<-M_PI)a+=2*M_PI;
			ret+=c.r*c.r*a;
		}
		else
		{
			pair<Point,Point>p=crosspoint(c,s);
			Point tmp[4]={s.p1,p.first,p.second,s.p2};
			if(intersect(c,Segment(s.p1,p.first))==2)swap(tmp[1],tmp[2]);
			for(int j=0;j<3;j++)
			{
				Segment t(tmp[j],tmp[j+1]);
				if(contain(c,t))ret+=cross(t.p1-c.o,t.p2-c.o);
				else{
					double a=arg(t.p2-c.o)-arg(t.p1-c.o);
					if(a>M_PI)a-=2*M_PI;
					if(a<-M_PI)a+=2*M_PI;
					ret+=c.r*c.r*a;
				}
			}
		}
	}
	return ret/2;
}
#line 3 "a.cpp"
int N,W;
Point p[10];
int h[10];
Circle C[10];
double calc(double h,double r)
{
	if(h>r)return r;
	else return sqrt(2*r*h-h*h);
}
bool in(Point p,double w)
{
	for(int i=0;i<N;i++)if(contain(C[i],p)==IN)return false;
	return w-EPS<p.x&&p.x<100-w+EPS&&w-EPS<p.y&&p.y<100-w+EPS;
}
main()
{
	while(cin>>N>>W,N)
	{
		for(int i=0;i<N;i++)cin>>p[i]>>h[i];
		double le=0,ri=1e6;
		for(int c=0;c<100;c++)
		{
			double r=(le+ri)/2;
			double w=calc(W,r);
			for(int i=0;i<N;i++)
			{
				C[i]=Circle(p[i],calc(h[i],r));
			}
			bool ok=false;
			for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)
			{
				int cnt=intersect(C[i],C[j]);
				if(cnt==0||cnt==4)continue;
				pair<Point,Point>tmp=crosspoint(C[i],C[j]);
				if(in(tmp.first,w)||in(tmp.second,w))ok=true;
			}
			Point cr[4]={Point(w,w),Point(w,100-w),Point(100-w,w),Point(100-w,100-w)};
			Line L[4]={Line(cr[0],cr[1]),Line(cr[0],cr[2]),Line(cr[1],cr[3]),Line(cr[2],cr[3])};
			for(int i=0;i<N;i++)for(int j=0;j<4;j++)if(intersect(C[i],L[j]))
			{
				pair<Point,Point>tmp=crosspoint(C[i],L[j]);
				if(in(tmp.first,w)||in(tmp.second,w))ok=true;
			}
			for(int i=0;i<4;i++)for(int j=i+1;j<4;j++)
			{
				if(in(crosspoint(L[i],L[j]),w))ok=true;
			}
			if(ok)le=r;
			else ri=r;
		}
		cout<<fixed<<setprecision(16)<<le<<endl;
	}
}
accuracy: 1
time_ms: 490
memory_kb: 3576
final_rank: 7

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=2005;
//const int INF=1<<30;
const ll INF=1LL<<60;
//幾何ライブラリ

const double eps=1e-8;
const double pi=acos((double)-1.0L);
#define equals(a,b) (fabs((a)-(b))<eps)

double torad(int deg) {return (double)(deg)*pi/180.0;}
double todeg(double ang) {return ang*180.0/pi;}

class Point{
public:
    double x,y;
    
    Point(double x=0,double y=0):x(x),y(y){}
    
    Point operator + (Point p){return Point(x+p.x,y+p.y);}
    Point operator - (Point p){return Point(x-p.x,y-p.y);}
    Point operator * (double a){return Point(a*x,a*y);}
    Point operator / (double a){return Point(x/a,y/a);}
    
    double abs(){return sqrt(norm());}
    double norm(){return x*x+y*y;}
    
    bool operator < (const Point &p)const{
        return x+eps<p.x||(equals(x,p.x)&&y+eps<p.y);
    }
    
    bool operator == (const Point &p)const{
        return fabs(x-p.x)<eps/100000&&fabs(y-p.y)<eps/100000;
    }
};

typedef Point Vector;

double norm(Vector a){
    return a.x*a.x+a.y*a.y;
}

double abs(Vector a){
    return sqrt(norm(a));
}

double dot(Vector a,Vector b){
    return a.x*b.x+a.y*b.y;
}

double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

struct Segment{
    Point p1,p2;
};

bool isOrthogonal(Vector a,Vector b){
    return equals(dot(a,b),0.0);
}

bool isOrthogonal(Point a1,Point a2,Point b1,Point b2){
    return isOrthogonal(a1-a2,b1-b2);
}

bool isOrthogonal(Segment s1,Segment s2){
    return equals(dot(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}

bool isParallel(Vector a,Vector b){
    return equals(cross(a,b),0.0);
}

bool isParallel(Point a1,Point a2,Point b1,Point b2){
    return isParallel(a1-a2,b1-b2);
}

bool isParallel(Segment s1,Segment s2){
    return equals(cross(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}

Point project(Segment s,Point p){
    Vector base=s.p2-s.p1;
    double r=dot(p-s.p1,base)/norm(base);
    return s.p1+base*r;
}

Point reflect(Segment s,Point p){
    return p+(project(s,p)-p)*2.0;
}

Point turn(Point p,Point c,double pi){
    double q=atan2(p.y-c.y,p.x-c.x);
    q+=pi;
    p=c+Point{cos(q)*abs(p-c),sin(q)*abs(p-c)};
    
    return p;
}
//pをcを中心としてpi回転させる(1周で2π)
//p=cのときnan

static const int counter_clockwise=1;
static const int clockwise=-1;
static const int online_back=2;
static const int online_front=-2;
static const int on_segment=0;

int ccw(Point p0,Point p1,Point p2){
    Vector a=p1-p0;
    Vector b=p2-p0;
    
    if(cross(a,b)>eps) return counter_clockwise;
    if(cross(a,b)<-eps) return clockwise;
    if(dot(a,b)<-eps) return online_back;
    if(a.norm()<b.norm()) return online_front;
    
    return on_segment;
}

bool intersect(Point p1,Point p2,Point p3,Point p4){
    return(ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0&&ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0);
}

bool intersect(Segment s1,Segment s2){
    return intersect(s1.p1,s1.p2,s2.p1,s2.p2);
}

bool overlap(Segment s1,Segment s2){
    int a=ccw(s1.p1,s1.p2,s2.p1),b=ccw(s1.p1,s1.p2,s2.p2);
    if(a&1||b&1) return 0;
    if(a==2){
        if(b==-2||(b==0&&!(s2.p2==s1.p1))) return 1;
        else return 0;
    }
    if(a==-2){
        if(b==2||(b==0&&!(s2.p2==s1.p2))) return 1;
        else return 0;
    }
    if(a==0){
        if(s1.p1==s2.p1){
            if(b!=2) return 1;
            else return 0;
        }
        else if(s1.p2==s2.p1){
            if(b!=-2) return 1;
            else return 0;
        }
        else return 1;
    }
    return 0;
}
//s1とs2の共通の線分(長さ0より大きい)があるかどうか

typedef Segment Line;

double getDistance(Point a,Point b){
    return abs(a-b);
}

double getDistanceLP(Line l,Point p){
    return abs(cross(l.p2-l.p1,p-l.p1)/abs(l.p2-l.p1));
}

double getDistanceSP(Segment s,Point p){
    if(dot(s.p2-s.p1,p-s.p1)<0.0) return abs(p-s.p1);
    if(dot(s.p1-s.p2,p-s.p2)<0.0) return abs(p-s.p2);
    return getDistanceLP(s,p);
}

double getDistance(Segment s1,Segment s2){
    if(intersect(s1,s2)) return 0.0;
    return min({getDistanceSP(s1,s2.p1),getDistanceSP(s1,s2.p2),getDistanceSP(s2,s1.p1),getDistanceSP(s2,s1.p2)});
}

Point getCrossPointS(Segment s1,Segment s2){
    //if(ccw(s1.p1,s1.p2,s2.p1)==0&&ccw(s1.p1,s1.p2,s2.p2)==0) return s1.p1;
    Vector base=s2.p2-s2.p1;
    double d1=abs(cross(base,s1.p1-s2.p1));
    double d2=abs(cross(base,s1.p2-s2.p1));
    double t=d1/(d1+d2);
    return s1.p1+(s1.p2-s1.p1)*t;
}//同じ時壊れます

Point getCrossPointL(Line l1,Line l2){
    //if(ccw(s1.p1,s1.p2,s2.p1)==0&&ccw(s1.p1,s1.p2,s2.p2)==0) return s1.p1;
    
    Vector v1=l1.p2-l1.p1,v2=l2.p2-l2.p1;
    
    return l1.p1+v1*cross(v2,l2.p1-l1.p1)/cross(v2,v1);
}

Segment ParallelSegment(Segment s,double d){
    Vector v={-(s.p2-s.p1).y,(s.p2-s.p1).x};
    v=v/abs(v);
    
    s.p1=s.p1+v*d;
    s.p2=s.p2+v*d;
    
    return s;
}

Point naisin(Line l1,Line l2,Line l3){
    //平行でない前提
    
    Point p1=getCrossPointL(l1,l2),p2=getCrossPointL(l1,l3),p3=getCrossPointL(l2,l3);
    if(p1==p2&&p2==p3&&p3==p1) return p1;
    
    return (p1*abs(p1)+p2*abs(p2)+p3*abs(p3))/(abs(p1)+abs(p2)+abs(p3));
}

//ネットの適当を書いたのであってるか全く知りません→あってそう

class Circle{
public:
    Point c;
    double r;
    Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

Point CircleCenter(Point a,Point b,Point c){
    Point u=a-b,v=a-c;
    double m1=(norm(a)-norm(b))/2.0,m2=(norm(a)-norm(c))/2.0;
    
    Point res;
    if(cross(u,v)==0.0){
        res.x=1e9;
        res.y=1e9;
        
        return res;
    }
    res.x=(m1*v.y-m2*u.y)/cross(u,v);
    res.y=(m1*v.x-m2*u.x)/cross(v,u);
    
    return res;
}
//3点を通る円の中心を返す

pair<Point,Point> segCrossPpoints(Circle c,Line l){
    //assert(intersect(c,l));
    Vector pr=project(l,c.c);
    Vector e=(l.p2-l.p1)/abs(l.p2-l.p1);
    double base=sqrt(c.r*c.r-norm(pr-c.c));
    return make_pair(pr+e*base,pr-e*base);
}

double arg(Vector p){return atan2(p.y,p.x);}
Vector polar(double a,double r){return Point(cos(r)*a,sin(r)*a);}

pair<Point,Point> getCrossPoints(Circle c1,Circle c2){
    //assert(intersect(c1,c2));
    double d=abs(c1.c-c2.c);
    double a=acos(max(-1.0,min(1.0,(c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d))));
    double t=arg(c2.c-c1.c);
    //cout<<d<<" "<<a<<" "<<t<<endl;
    return make_pair(c1.c+polar(c1.r,t+a),c1.c+polar(c1.r,t-a));
}

vector<Line> Commontangent(Circle c1,Circle c2){
    vector<Line> res;
    Point p=c2.c-c1.c;
    
    if(abs(p)>=(c1.r+c2.r)){
        Point a,b;
        a.x=c1.r*(p.x*(c1.r+c2.r)+p.y*sqrt(norm(p)-(c1.r+c2.r)*(c1.r+c2.r)))/norm(p);
        a.y=c1.r*(p.y*(c1.r+c2.r)-p.x*sqrt(norm(p)-(c1.r+c2.r)*(c1.r+c2.r)))/norm(p);
        
        b.x=c1.r*(p.x*(c1.r+c2.r)-p.y*sqrt(norm(p)-(c1.r+c2.r)*(c1.r+c2.r)))/norm(p);
        b.y=c1.r*(p.y*(c1.r+c2.r)+p.x*sqrt(norm(p)-(c1.r+c2.r)*(c1.r+c2.r)))/norm(p);
        
        res.push_back(Line{a+c1.c,a+c1.c+Point{-a.y,a.x}});
        if(!(a==b)){
            res.push_back(Line{b+c1.c,b+c1.c+Point{-b.y,b.x}});
        }
    }
    
    if(abs(p)>=abs(c1.r-c2.r)){
        Point a,b;
        a.x=c1.r*(p.x*(c1.r-c2.r)+p.y*sqrt(norm(p)-(c1.r-c2.r)*(c1.r-c2.r)))/norm(p);
        a.y=c1.r*(p.y*(c1.r-c2.r)-p.x*sqrt(norm(p)-(c1.r-c2.r)*(c1.r-c2.r)))/norm(p);
        
        b.x=c1.r*(p.x*(c1.r-c2.r)-p.y*sqrt(norm(p)-(c1.r-c2.r)*(c1.r-c2.r)))/norm(p);
        b.y=c1.r*(p.y*(c1.r-c2.r)+p.x*sqrt(norm(p)-(c1.r-c2.r)*(c1.r-c2.r)))/norm(p);
        
        res.push_back(Line{a+c1.c,a+c1.c+Point{-a.y,a.x}});
        if(!(a==b)){
            res.push_back(Line{b+c1.c,b+c1.c+Point{-b.y,b.x}});
        }
    }
    
    return res;
}

typedef vector<Point> Polygon;

/*
 IN 2
 ON 1
 OUT 0
 */

int contains(Polygon g,Point p){
    int n=int(g.size());
    bool x=false;
    for(int i=0;i<n;i++){
        Point a=g[i]-p,b=g[(i+1)%n]-p;
        if(a.y>b.y) swap(a,b);
        if(a.y<eps&&eps<b.y&&cross(a,b)>eps) x=!x;
    }
    return (x?2:0);
}

Polygon andrewScan(Polygon s,bool ok){
    Polygon u,l;
    sort(all(s));
    
    if(int(s.size())<3) return s;
    int n=int(s.size());
    
    u.push_back(s[0]);
    u.push_back(s[1]);
    
    l.push_back(s[n-1]);
    l.push_back(s[n-2]);
    
    if(ok){
        for(int i=2;i<n;i++){
            for(int j=int(u.size());j>=2&&ccw(u[j-2],u[j-1],s[i])==counter_clockwise;j--){
                u.pop_back();
            }
            u.push_back(s[i]);
        }
        
        for(int i=int(s.size())-3;i>=0;i--){
            for(int j=int(l.size());j>=2&&ccw(l[j-2],l[j-1],s[i])==counter_clockwise;j--){
                l.pop_back();
            }
            l.push_back(s[i]);
        }
    }
    
    if(!ok){
        for(int i=2;i<n;i++){
            for(int j=int(u.size());j>=2&&ccw(u[j-2],u[j-1],s[i])!=clockwise;j--){
                u.pop_back();
            }
            u.push_back(s[i]);
        }
        
        for(int i=int(s.size())-3;i>=0;i--){
            for(int j=int(l.size());j>=2&&ccw(l[j-2],l[j-1],s[i])!=clockwise;j--){
                l.pop_back();
            }
            l.push_back(s[i]);
        }
    }
    
    reverse(all(l));
    
    for(int i=int(u.size())-2;i>=1;i--) l.push_back(u[i]);
    
    return l;
}//ok==1なら辺の上も含める

Polygon convex_cut(const Polygon& P, const Line& l) {
    Polygon Q;
    for(int i=0;i<si(P);i++){
        Point A=P[i],B=P[(i+1)%si(P)];
        if(ccw(l.p1,l.p2,A)!=-1)Q.push_back(A);
        if(ccw(l.p1,l.p2,A)*ccw(l.p1,l.p2,B)<0) Q.push_back(getCrossPointL(Line{A,B},l));
    }
    return Q;
}

double area(Point a,Point b,Point c){
    b=b-a;
    c=c-a;
    return abs(b.x*c.y-b.y*c.x)/2.0;
}

double area(Polygon &P){
    if(si(P)==0) return 0.0;
    double res=0;
    Point c={0.0,0.0};
    for(int i=0;i<si(P);i++){
        c=c+P[i];
    }
    c=c/si(P);
    
    for(int i=0;i<si(P);i++){
        res+=area(c,P[i],P[(i+1)%si(P)]);
    }
    
    return res;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,W;cin>>N>>W;
        if(N==0) break;
        vector<Point> P(N);
        vector<double> h(N);
        for(int i=0;i<N;i++) cin>>P[i].x>>P[i].y>>h[i];
        
        double left=0,right=3000;
        for(int q=0;q<100;q++){
            double mid=(left+right)/2.0;
            vector<Circle> C(N);
            for(int i=0;i<N;i++){
                C[i].c=P[i];
                if(h[i]<=mid){
                    C[i].r=sqrt((h[i])*(2.0*mid-h[i]));
                }else{
                    C[i].r=mid;
                }
            }
            double lim;
            if(W<=mid) lim=sqrt((W)*(2.0*mid-W));
            else lim=mid;
            
            vector<Point> p={{lim,lim},{100-lim,lim},{100-lim,100-lim},{lim,100-lim}};
            vector<Line> l(4);
            for(int i=0;i<4;i++) l[i]={p[i],p[(i+1)%4]};
            
            bool ok=false;
            for(int i=0;i<N;i++){
                for(int j=i+1;j<N;j++){
                    double d=getDistance(C[i].c,C[j].c);
                    if(C[i].r+C[j].r>d){
                        auto ps=getCrossPoints(C[i],C[j]);
                        
                        //assert(abs(getDistance(C[i].c,ps.fi)-C[i].r)<1e-5);
                        //cout<<getDistance(C[i].c,ps.fi)<<" "<<C[i].r<<endl;
                        assert(d>1e-5);
                        assert(C[i].r>1e-5);
                        assert(C[j].r>1e-5);
                        //cout<<ps.fi.x<<" "<<ps.fi.y<<" "<<ps.se.x<<" "<<ps.se.y<<endl;
                        
                        for(int t=0;t<2;t++){
                            bool safe=true;
                            for(int k=0;k<N;k++){
                                double d2=getDistance(ps.fi,C[k].c);
                                if(d2<C[k].r-eps) safe=false;
                            }
                            
                            if(ps.fi.x<lim-eps) safe=false;
                            if(ps.fi.x>100.0-lim+eps) safe=false;
                            if(ps.fi.y<lim-eps) safe=false;
                            if(ps.fi.y>100.0-lim+eps) safe=false;
                            
                            if(safe) ok=true;
                            swap(ps.fi,ps.se);
                        }
                    }
                }
                for(int k=0;k<4;k++){
                    double d=getDistanceLP(l[k],C[i].c);
                    if(d<C[i].r-eps){
                        auto ps=segCrossPpoints(C[i],l[k]);
                        for(int t=0;t<2;t++){
                            bool safe=true;
                            for(int a=0;a<N;a++){
                                double d2=getDistance(ps.fi,C[a].c);
                                if(d2<C[a].r-eps) safe=false;
                            }
                            
                            if(ps.fi.x<lim-eps) safe=false;
                            if(ps.fi.x>100.0-lim+eps) safe=false;
                            if(ps.fi.y<lim-eps) safe=false;
                            if(ps.fi.y>100.0-lim+eps) safe=false;
                            
                            if(safe) ok=true;
                            swap(ps.fi,ps.se);
                        }
                    }
                }
            }
            
            for(int t=0;t<4;t++){
                bool safe=true;
                for(int k=0;k<N;k++){
                    double d2=getDistance(p[t],C[k].c);
                    if(d2<C[k].r-eps) safe=false;
                }
                
                if(safe) ok=true;
            }
            
            if(lim>=50) ok=false;
            
            if(ok) left=mid;
            else right=mid;
        }
        
        cout<<fixed<<setprecision(25)<<left<<endl;
    }
}
accuracy: 1
time_ms: 200
memory_kb: 4124
final_rank: 17

code_snippet: #define MOD_TYPE 1

#pragma region Macros

#include <bits/stdc++.h>
using namespace std;

#if 0
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
#endif
#if 0
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = ;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-10;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

struct io_init
{
  io_init()
  {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(30) << setiosflags(ios::fixed);
  };
} io_init;
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

using Real = ld;
using Point = complex<Real>;

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }
inline bool eq(Point a, Point b) { return fabs(b - a) < EPS; }

Point operator*(const Point &p, const Real &d)
{
  return Point(real(p) * d, imag(p) * d);
}

istream &operator>>(istream &is, Point &p)
{
  Real a, b;
  is >> a >> b;
  p = Point(a, b);
  return is;
}

ostream &operator<<(ostream &os, Point &p)
{
  return os << fixed << setprecision(20) << p.real() << " " << p.imag();
}

// 点 p を反時計回りに theta 回転
inline Point rotate(Real theta, const Point &p)
{
  return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r)
{
  return (r * 180.0 / PI);
}

Real degree_to_radian(Real d)
{
  return (d * PI / 180.0);
}

// a-b-c の角度のうち小さい方を返す
Real get_angle(Point a, Point b, Point c)
{
  a -= b, c -= b;
  Real alpha = atan2(a.imag(), a.real()), beta = atan2(c.imag(), c.real());
  if (alpha > beta)
    swap(alpha, beta);
  Real theta = (beta - alpha);
  return min(theta, 2 * acos(-1) - theta);
}

// a-b-c の角度（[0,2π)、a を反時計回りに回転させてcに重ねる角度）
Real get_angle2(Point a, Point b, Point c)
{
  a -= b, c -= b;
  Real theta = atan2(imag(c), real(c)) - atan2(imag(a), real(a));
  while (theta < 0)
    theta += PI * 2;
  while (theta > PI * 2)
    theta -= PI * 2;
  return theta;
}

// a-b-c の角度（[0,2π)、p を間に含む方）
Real get_angle2(const Point &a, const Point &b, const Point &c, const Point &p)
{
  if (get_angle2(a, b, p) + get_angle2(p, b, c) < PI * 2)
    return get_angle2(a, b, c);
  else
    return get_angle2(c, b, a);
}

namespace std
{
  bool operator<(const Point &a, const Point &b)
  {
    return !eq(a.real(), b.real()) ? a.real() < b.real() : a.imag() < b.imag();
  }
} // namespace std

struct Line
{
  Point a, b;
  Line() = default;
  Line(Point a, Point b) : a(a), b(b) {}
  Line(Real A, Real B, Real C) // Ax + By = C
  {
    if (eq(A, 0))
      a = Point(0, C / B), b = Point(1, C / B);
    else if (eq(B, 0))
      b = Point(C / A, 0), b = Point(C / A, 1);
    else
      a = Point(0, C / B), b = Point(C / A, 0);
  }

  friend ostream &operator<<(ostream &os, Line &p)
  {
    return os << p.a << " to " << p.b;
  }

  friend istream &operator>>(istream &is, Line &a)
  {
    return is >> a.a >> a.b;
  }
};

// Ax + By = C
tuple<Real, Real, Real> parameter(const Line &l)
{
  Real A = imag(l.b) - imag(l.a);
  Real B = real(l.a) - real(l.b);
  Real C = real(l.a) * A + imag(l.a) * B;
  return {A, B, C};
}

struct Segment : Line
{
  Segment() = default;
  Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle
{
  Point p;
  Real r;
  Circle() = default;
  Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Segments = vector<Segment>;
using Lines = vector<Line>;
using Circles = vector<Circle>;

inline Real cross(const Point &a, const Point &b)
{
  return real(a) * imag(b) - imag(a) * real(b);
}

inline Real dot(const Point &a, const Point &b)
{
  return real(a) * real(b) + imag(a) * imag(b);
}

// 直線がx軸となす角 [0, π)
// to do: verify
inline Real get_angle(const Line &l)
{
  Point p = l.a - l.b;
  if (imag(p) < 0)
    p *= -1;
  return get_angle2(Point(1, 0), Point(0, 0), p);
}

// 2直線がなす角 [0, π/2]
// to do: verify
inline Real get_angle(const Line &l1, const Line &l2)
{
  Real theta = get_angle(l1) - get_angle(l2);
  if (theta < 0)
    theta += PI;
  return theta >= PI / 2.0 ? theta - PI / 2.0 : theta;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c)
{
  b = b - a, c = c - a;
  if (cross(b, c) > EPS)
    return +1; // "COUNTER_CLOCKWISE"
  if (cross(b, c) < -EPS)
    return -1; // "CLOCKWISE"
  if (dot(b, c) < 0)
    return +2; // "ONLINE_BACK"
  if (norm(b) < norm(c))
    return -2; // "ONLINE_FRONT"
  return 0;    // "ON_SEGMENT"
}

// p, q を m : n に内分する点
inline Point internal(const Point &p, const Point &q, Real m, Real n)
{
  return (n * p + m * q) / (m + n);
}

// p, q を m : n に外分する点
inline Point external(const Point &p, const Point &q, Real m, Real n)
{
  return internal(p, q, m, -n);
}

// 垂直ベクトル
inline Point orthvector(const Point p)
{
  return Point(imag(p), -real(p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
inline bool parallel(const Line &a, const Line &b)
{
  return eq(cross(a.b - a.a, b.b - b.a), 0.0);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
inline bool orthogonal(const Line &a, const Line &b)
{
  return eq(dot(a.a - a.b, b.a - b.b), 0.0);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
// 射影
// 直線 l に p から垂線を引いた交点を求める
inline Point projection(const Line &l, const Point &p)
{
  double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + (l.a - l.b) * t;
}

inline Point projection(const Segment &l, const Point &p)
{
  double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + (l.a - l.b) * t;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// 反射
// 直線 l を対称軸として点 p と線対称にある点を求める
inline Point reflection(const Line &l, const Point &p)
{
  return p + (projection(l, p) - p) * 2.0;
}

// 点 p を通り直線 l に垂直な直線
inline Line verticalline(const Line &l, const Point &p)
{
  return Line(p, p + orthvector(l.a - l.b));
}

// 点 p, q の垂直二等分線
inline Line bisector(const Point &p, const Point &q)
{
  Line l(p, q);
  Point m = internal(p, q, 1, 1);
  return verticalline(l, m);
}
inline Line bisector(const Segment &sg)
{
  return bisector(sg.a, sg.b);
}

inline bool intersect(const Line &l, const Point &p)
{
  return abs(ccw(l.a, l.b, p)) != 1;
}

inline bool intersect(const Line &l, const Line &m)
{
  return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS;
}

inline bool intersect(const Segment &s, const Point &p)
{
  return ccw(s.a, s.b, p) == 0;
}

inline bool intersect(const Line &l, const Segment &s)
{
  return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS;
}

inline Real distance(const Line &l, const Point &p);

inline bool intersect(const Circle &c, const Line &l)
{
  return distance(l, c.p) <= c.r + EPS;
}

inline bool intersect(const Circle &c, const Point &p)
{
  return abs(abs(p - c.p) - c.r) < EPS;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
bool intersect(const Segment &s, const Segment &t)
{
  return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l)
{
  if (norm(projection(l, c.p) - c.p) - c.r * c.r > EPS)
    return 0;
  auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
  if (d1 < c.r + EPS && d2 < c.r + EPS)
    return 0;
  if (d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS)
    return 1;
  const Point h = projection(l, c.p);
  if (dot(l.a - h, l.b - h) < 0)
    return 2;
  return 0;
}

// 共通接戦の本数
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2)
{
  if (c1.r < c2.r)
    swap(c1, c2);
  Real d = abs(c1.p - c2.p);
  if (c1.r + c2.r < d)
    return 4;
  if (eq(c1.r + c2.r, d))
    return 3;
  if (c1.r - c2.r < d)
    return 2;
  if (eq(c1.r - c2.r, d))
    return 1;
  return 0;
}

inline Real distance(const Point &a, const Point &b)
{
  return abs(a - b);
}

inline Real distance(const Line &l, const Point &p)
{
  return abs(p - projection(l, p));
}

inline Real distance(const Line &l, const Line &m)
{
  return intersect(l, m) ? 0 : distance(l, m.a);
}

inline Real distance(const Segment &s, const Point &p)
{
  Point r = projection(s, p);
  if (intersect(s, r))
    return abs(r - p);
  return min(abs(s.a - p), abs(s.b - p));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b)
{
  if (intersect(a, b))
    return 0;
  return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s)
{
  if (intersect(l, s))
    return 0;
  return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m)
{
  Real A = cross(l.b - l.a, m.b - m.a);
  Real B = cross(l.b - l.a, l.b - m.a);
  if (eq(abs(A), 0.0) && eq(abs(B), 0.0))
    return m.a;
  return m.a + (m.b - m.a) * B / A;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m)
{
  return crosspoint(Line(l), Line(m));
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair<Point, Point> crosspoint(const Circle &c, const Line l)
{
  Point pr = projection(l, c.p);
  Point e = (l.b - l.a) / abs(l.b - l.a);
  if (eq(distance(l, c.p), c.r))
    return {pr, pr};
  double base = sqrt(c.r * c.r - norm(pr - c.p));
  return {pr - e * base, pr + e * base};
}

pair<Point, Point> crosspoint(const Circle &c, const Segment &l)
{
  Line aa = Line(l.a, l.b);
  if (intersect(c, l) == 2)
    return crosspoint(c, aa);
  auto ret = crosspoint(c, aa);
  if (dot(l.a - ret.first, l.b - ret.first) < 0)
    ret.second = ret.first;
  else
    ret.first = ret.second;
  return ret;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2)
{
  Real d = abs(c1.p - c2.p);
  Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
  Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
  Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
  Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
  return {p1, p2};
}

int n;
Real w;
vector<Point> p;
vector<Real> h;

bool ok(Point &q, Real r)
{
  Real x = real(q), y = imag(q);
  if (r < w)
  {
    for (Real d : {x - 0, 100 - x, y - 0, 100 - y})
    {
      if (d < r)
        return false;
    }
  }
  else
  {
    for (Real d : {x - 0, 100 - x, y - 0, 100 - y})
    {
      if (d < 0)
        return false;
      d = sqrt(d * d + (r - w) * (r - w));
      if (d < r)
        return false;
    }
  }
  rep(i, n)
  {
    Real d;
    if (r < h[i])
    {
      d = distance(q, p[i]);
    }
    else
    {
      d = distance(q, p[i]);
      d = sqrt(d * d + (r - h[i]) * (r - h[i]));
    }
    if (d < r)
      return false;
  }
  return true;
}

bool check(Real r)
{
  vector<Circle> c(n);
  rep(i, n)
  {
    Real d;
    if (r < h[i])
    {
      d = r;
    }
    else
    {
      d = r * r - (r - h[i]) * (r - h[i]);
      if (d < -EPS)
        return false;
      chmax(d, Real(0.0));
      d = sqrt(d);
    }
    d += EPS;
    c[i] = Circle(p[i], d);
  }
  Points ps;
  rep(i, n) REP(j, i + 1, n)
  {
    int res = intersect(c[i], c[j]);
    if (1 <= res and res <= 3)
    {
      auto [p1, p2] = crosspoint(c[i], c[j]);
      ps.push_back(p1);
      ps.push_back(p2);
    }
  }

  Line l[4];
  Real d;
  if (r < w)
    d = r;
  else
  {
    d = r * r - (r - w) * (r - w);
    if (d < -EPS)
      return false;
    chmax(d, Real(0.0));
    d = sqrt(d);
  }
  d += EPS;
  Point LD(d, d), LU(d, 100 - d), RD(100 - d, d), RU(100 - d, 100 - d);
  l[0] = Line(LU, LD);
  l[1] = Line(LD, RD);
  l[2] = Line(RD, RU);
  l[3] = Line(RU, LU);
  ps.push_back(LD);
  rep(li, 4)
  {
    rep(i, n)
    {
      if (intersect(c[i], l[li]))
      {
        auto [p1, p2] = crosspoint(c[i], l[li]);
        ps.push_back(p1);
        ps.push_back(p2);
      }
    }
  }

  for (auto pi : ps)
  {
    if (ok(pi, r))
      return true;
  }
  return false;
}

void solve()
{
  cin >> n >> w;
  if (w == 0)
    exit(0);
  p.resize(n);
  h.resize(n);
  rep(i, n) cin >> p[i] >> h[i];
  Real lo = 0, hi = 1e5;
  rep(ti, 100)
  {
    Real mi = (lo + hi) / 2.0;
    if (check(mi))
      lo = mi;
    else
      hi = mi;
  }
  cout << hi << "\n";
}

int main()
{
  while (1)
    solve();
}
accuracy: 1
time_ms: 890
memory_kb: 3884
final_rank: 12

code_snippet: #include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

using CP = complex<long double>;

const long double EPS = 1e-10;     // 許容する誤差ε
#define EQ(a, b) (abs((a)-(b)) < EPS)   // 2つのスカラーが等しいかどうか
#define EQV(a, b) (EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))    // 2つのベクトルが等しいかどうか

// double length = abs(a);     // ベクトルaの絶対値
// double distance = abs(a-b);     // 2点a,b間の距離
// CP b = a/abs(a);    // ベクトルaの単位ベクトル
// CP n1 = a*CP(0,+1); CP n2 = a*CP(0,-1);  // ベクトルaの法線ベクトル
// CP un1 = (a*CP(0,+1)/abs(a)); CP un2 = (a*CP(0,-1)/abs(a));  // ベクトルaの単位法線ベクトル

// 内積(dot product) : a・b = |a||b|cosΘ
long double dot(CP a, CP b) {
    return (a.real()*b.real() + a.imag()*b.imag());
}

// 外積(cross product) : a×b = |a||b|sinΘ
long double cross(CP a, CP b) {
    return (a.real()*b.imag() - a.imag()*b.real());
}

// 直線の表現
struct Segment {
    CP s, t;
    Segment(long double sx = 0.0L, long double sy = 0.0L,
            long double tx = 0.0L, long double ty = 0.0L)
            : s(CP(sx, sy)), t(CP(tx, ty)) {}
    Segment(CP _s, CP _t) : s(_s), t(_t) {}
}; typedef Segment Line;

// 2直線の直交判定 : a⊥b ⇔ dot(a,b) = 0
int is_orthogonal(CP a1, CP a2, CP b1, CP b2) {
    return EQ(dot(a1-a2, b1-b2), 0.0);
}

// 2直線の平行判定 : a//b ⇔ cross(a,b) = 0
int is_parallel(CP a1, CP a2, CP b1, CP b2) {
    return EQ(cross(a1-a2, b1-b2), 0.0);
}

// 点cが直線a,b上にあるかないか
int is_point_on_line(CP a, CP b, CP c) {
    return EQ(cross(b-a, c-a), 0.0);
}

// 点cが線分a,b上にあるかないか
int is_point_on_lines(CP a, CP b, CP c) {
    // |a-c|+|c-b| <= |a-b|なら線分上
    return (abs(a-c)+abs(c-b) < abs(a-b)+EPS);
}

// a1,a2を端点とする線分とb1,b2を端点とする線分の交差判定
int is_intersected_lines(CP a1, CP a2, CP b1, CP b2) {
    if(is_parallel(a1, a2, b1, b2)) {
        // 平行なので線分の重なり判定
        return is_point_on_lines(a1, a2, b1) || is_point_on_lines(a1, a2, b2) ||
               is_point_on_lines(b1, b2, a1) || is_point_on_lines(b1, b2, a2);
    }
    return (cross(a2-a1, b1-a1)*cross(a2-a1, b2-a1) < EPS) &&
           (cross(b2-b1, a1-b1)*cross(b2-b1, a2-b1) < EPS);
}

// a1,a2を端点とする線分とb1,b2を端点とする線分の交点計算
CP intersection_lines(CP a1, CP a2, CP b1, CP b2) {
    CP b = b2-b1;
    long double d1 = abs(cross(b, a1-b1));
    long double d2 = abs(cross(b, a2-b1));
    long double t = d1/(d1+d2);
    return a1+(a2-a1)*t;
}

// a1,a2を通る直線とb1,b2を通る直線の交差判定
int is_intersected_line(CP a1, CP a2, CP b1, CP b2) {
    return !EQ(cross(a1-a2, b1-b2), 0.0);
}

// a1,a2を通る直線とb1,b2を通る直線の交点計算(平行ではない前提)
CP intersection_line(CP a1, CP a2, CP b1, CP b2) {
    CP a = a2-a1; CP b = b2-b1;
    return a1 + a*cross(b, b1-a1)/cross(b, a);
}

// 点a,bを通る直線と点cとの距離
long double distance_line_p(CP a, CP b, CP c) {
    return abs(cross(b-a, c-a))/abs(b-a);
}

// 点a,bを端点とする線分と点cとの距離
long double distance_lines_p(CP a, CP b, CP 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);
}

// 点a1,a2を端点とする線分と点b1,b2を端点とする線分の最短距離
long double distance_lines_lines(CP a1, CP a2, CP b1, CP b2) {
    long double res = 1e18;
    if(is_intersected_lines(a1, a2, b1, b2)) return 0.0L;
    res = min(res, distance_lines_p(a1, a2, b1));
    res = min(res, distance_lines_p(a1, a2, b2));
    res = min(res, distance_lines_p(b1, b2, a1));
    res = min(res, distance_lines_p(b1, b2, a2));
    return res;
}

// s,tを通る直線に対する点pの射影
CP projection(CP s, CP t, CP p) {
    if(EQV(s, t)) return s;
    CP base = t-s;
    return s + base*(dot(p-s, base)/norm(base));
}

// s,tを通る直線に対する点pの反射
CP reflection(CP s, CP t, CP p) {
    CP tmp = projection(s, t, p) - p;
    return p + tmp*2.0L;
}

// 角度Θ回転
CP translate(CP v, long double theta) {
    CP res = v * CP(cosl(theta), sinl(theta));
    return res;
}

// n多角形の面積計算
long double polygon_area(const vector<CP> &v) {
    int n = v.size();
    long double res = 0;
    for(int i = 0; i < n; ++i) {
        res += cross(v[(i+n-1)%n], v[(i+n)%n]);
    }
    return fabsl(res)/2.0L;
}

// n多角形の凸性判定
int is_convex(const vector<CP> &v) {
    int n = v.size();
    for(int i = 0; i < n; ++i) {
        if(cross(v[(i+1)%n]-v[i], v[(i+2)%n]-v[(i+1)%n]) < -EPS) return 0;
    }
    return 1;
}

// 凸包(全ての頂点が一直線に並ぶときは例外)
vector<CP> convex_hull(vector<CP> &v) {
    // x座標→y座標で頂点をソート
    auto lmd = [&](const CP &l, const CP &r) {
        if(l.imag() != r.imag()) return l.imag() < r.imag();
        return l.real() < r.real();
        return l.imag() < r.imag();
    };
    vector<CP> res;     // 凸包を構成する頂点
    int n = v.size();
    sort(v.begin(), v.end(), lmd);
    bool flgx = true;
    for(int i = 0; i < n; ++i) {
        if(v[i].real() != v[(i+1)%n].real()) {
            flgx = false;
            break;
        }
    }
    bool flgy = true;
    for(int i = 0; i < n; ++i) {
        if(v[i].imag() != v[(i+1)%n].imag()) {
            flgy = false;
            break;
        }
    }
    if(flgx || flgy) {
        res.emplace_back(v[0]);
        res.emplace_back(v[n-1]);
        return res;
    }
    int k = 0;
    res.resize(n*2);
    // 下側凸包
    for(int i = 0; i < n; ++i) {
        while(k > 1 && cross(res[k-1]-res[k-2], v[i]-res[k-1]) < 0) {
            --k;
        }
        res[k++] = v[i];
    }
    // 上側凸包
    for(int i = n-2, t = k; i >= 0; --i) {
        while(k > t && cross(res[k-1]-res[k-2], v[i]-res[k-1]) < 0) {
            --k;
        }
        res[k++] = v[i];
    }
    res.resize(k-1);
    return res;
}

// 凸多角形の直径
long double convex_diameter(vector<CP> &v) {
    vector<CP> cv = convex_hull(v);
    int n = cv.size();
    if(n == 2) return abs(cv[0]-cv[1]);     // 凸包が潰れている例外処理
    int i = 0, j = 0;   // x軸方向に最も遠い点対
    for(int k = 0; k < n; ++k) {
        if(cv[k].real() < cv[i].real()) i = k;
        if(cv[k].real() > cv[j].real()) j = k;
    }
    long double res = 0;
    int si = i, sj = j;
    while(i != sj || j != si) {     // 180度回転で終了
        res = max(res, abs(cv[i]-cv[j]));
        if(cross(cv[(i+1)%n]-cv[i], cv[(j+1)%n]-cv[j]) < 0) {
            (++i) %= n;
        }else {
            (++j) %= n;
        }
    }
    return res;
}

// 凸多角形を点s,tを通る直線で切断(左側が取得できる)
vector<CP> convex_cut(const vector<CP> &v, const CP &s, const CP &t) {
    vector<CP> res;
    int n = v.size();
    for(int i = 0; i < n; ++i) {
        CP nows = v[i], nowt = v[(i+1)%n];
        if(cross(t-s, nows-s) >= -EPS) res.emplace_back(nows);
        if(cross(t-s, nows-s)*cross(t-s, nowt-s) < 0) {
            res.emplace_back(intersection_line(s, t, nows, nowt));
        }
    }
    return res;
}

// n多角形に対する点pの包含関係(自己交差多角形は例外)
int contain_polygon_point(const vector<CP> &v, CP p) {
    int contain = 0, on_segment = 0;
    int n = v.size();
    for(int i = 0; i < n; ++i) {
        on_segment |= is_point_on_lines(v[i], v[(i+1)%n], p);   // 辺上判定
        CP s = v[i]-p, t = v[(i+1)%n]-p;
        if(s.imag() > t.imag()) swap(s, t);     // 下側を基準にする
        if(s.imag()*t.imag() <= 0 && t.imag() > 0 && cross(s, t) > 0) {
            contain = !contain;     // 交差回数が奇数なら内側
        }
    }
    if(on_segment) return 1;    // 辺上
    if(contain) return 2;       // 内側
    return 0;       // 外側
}

// 最近点対距離
long double closest_pair(vector<CP> &v, int l = -1, 
                         int r = -1, bool reqsqrt = 0) {
    if(l == r && l == -1) {
        l = 0; r = v.size(); reqsqrt = 1;
        // x座標→y座標で昇順ソート
        auto lmd = [&](const CP &l, const CP &r) {
            if(l.real() != r.real()) return l.real() < r.real();
            return l.imag() < r.imag();
        };
        sort(v.begin(), v.end(), lmd);
    }
    if(r-l < 2) return 1e18;    // 2点存在しない
    if(r-l == 2) {      // ちょうど2点の時
        if(v[l].imag() > v[l+1].imag()) swap(v[l], v[l+1]);
        if(reqsqrt) return abs(v[l]-v[l+1]);
        return norm(v[l]-v[l+1]);
    }
    // 2点以上に関して分割統治法
    int mid = (l+r)/2;
    long double x = v[mid].real();  // 分断する線のx座標
    // 左半分，右半分について再帰，同一領域内の最小距離resを求める
    long double res = min(closest_pair(v, l, mid), closest_pair(v, mid, r));
    auto f = [](CP pl, CP pr) { return pl.imag() < pr.imag(); };
    inplace_merge(v.begin()+l, v.begin()+mid, v.begin()+r, f);
    vector<CP> tmp;
    // 異なる領域の2点について最小距離res未満で探索
    for(int i = l; i < r; ++i) {
        long double dx = abs(v[i].real()-x);
        int tsize = tmp.size();
        if(dx*dx >= res) continue;
        for(int j = 0; j < tsize; ++j) {
            CP delta = v[i]-tmp[tsize-1-j];
            if(delta.imag()*delta.imag() >= res) break;
            res = min(res, norm(delta));
        }
        tmp.emplace_back(v[i]);
    }
    if(reqsqrt) res = sqrtl(res);
    return res;
}

// 円の表現
struct Circle {
    CP o;
    long double r;
    Circle(long double _x = 0.0L, long double _y = 0.0L,
           long double _r = 0.0L)
        : o(CP(_x, _y)), r(_r) {}
    Circle(CP _o, long double _r = 0.0) : o(_o), r(_r) {}
}; typedef vector<CP> Polygon;

// 2円の位置関係
int is_cross_circles(Circle l, Circle r) {
    long double distlr = abs(l.o-r.o);
    if(l.r+r.r+EPS < distlr) return 4;         // 交点無し外側
    if(r.r+distlr+EPS < l.r) return -2;          // 交点無し内側(R in L)
    if(l.r+distlr+EPS < r.r) return 2;          // 交点無し内側(L in R)
    if(abs(l.r+r.r-distlr) < EPS) return 3;    // 外接
    if(abs(l.r+distlr-r.r) < EPS) return -1;     // 内接(R in L)
    if(abs(r.r+distlr-l.r) < EPS) return 1;     // 内接(L in R)
    return 0;                                   // 2点で交わる
}

// 円に対する点の包含
bool contain_point(Circle c, CP p) {
    long double dist = abs(c.o-p);
    return dist < c.r+EPS;
}

// 円と直線の交点
vector<CP> intersection_circle_line(Circle ci, CP s, CP t) {
    vector<CP> res(2);  // 1点の場合同じ座標
    res[0] = res[1] = projection(s, t, ci.o);   // 2等分点の座標
    long double d = ci.r*ci.r - norm(res[0]-ci.o);
    if(d <= EPS || t == s) return res;
    CP ust = (t-s)/abs(t-s);    // stの単位ベクトル
    res[0] += (ust*sqrtl(d));
    res[1] -= (ust*sqrtl(d));
    if(res[0].real() > res[1].real() ||
       (res[0].real() == res[1].real() && res[0].imag() > res[1].imag())) {
           swap(res[0], res[1]);
    }
    return res;
}

// 2円の交点(1つは交点が存在する)
vector<CP> intersection_circle_circle(Circle c1, Circle c2) {
    vector<CP> res(2);  // 1点の場合同じ座標
    long double d = abs(c1.o-c2.o);
    long double arg = acosl((c1.r*c1.r+d*d-c2.r*c2.r)/(2.0L*c1.r*d));
    CP c1p = (c2.o-c1.o)*CP(cosl(arg), sinl(arg));
    CP uc1p = c1p/abs(c1p);     // c1の中心から交点p方向への単位ベクトル
    res[0] = c1.o + c1.r*uc1p;
    res[1] = reflection(c1.o, c2.o, res[0]);    // p,qの位置関係は反射
    if(res[0].real() > res[1].real() ||
       (res[0].real() == res[1].real() && res[0].imag() > res[1].imag())) {
           swap(res[0], res[1]);
    }
    return res;
}

// 線分lrの垂直二等分線
Line vertical_bisector(CP l, CP r) {
    Circle c1 = Circle(l, abs(l-r)), c2 = Circle(r, abs(l-r));
    vector<CP> res = intersection_circle_circle(c1, c2);
    if(cross(r-l, res[0]-l) > 0) swap(res[0], res[1]);
    return Line(res[0], res[1]);
}

// 点pを通る円の接線の接点
vector<CP> contact_circle_point(Circle ci, CP p) {
    vector<CP> res(2);
    long double d = abs(ci.o-p);
    if(abs(d-ci.r) <= EPS) {
        res[0] = res[1] = p;
    }else if(d < ci.r) {
        res[0] = res[1] = CP(-1e18, -1e18);
    }else {
        long double arg = asinl(ci.r/d);
        CP p0 = (ci.o-p)*CP(cosl(arg), sinl(arg));
        CP up0 = p0/abs(p0);
        res[0] = p + d*cosl(arg)*up0;
        res[1] = reflection(p, ci.o, res[0]);
        if(res[0].real() > res[1].real() || 
           (res[0].real() == res[1].real() && res[0].imag() > res[1].imag())) {
               swap(res[0], res[1]);
        }
    }
    return res;
}

// 2円の共通接線
vector<Line> tangent_circle_circle(Circle cl, Circle cr) {
    vector<Line> res;
    if(cl.r < cr.r) swap(cl, cr);
    long double g = abs(cl.o-cr.o);
    if(abs(g-0.0L) <= EPS) return res;  // 内包
    CP hor = (cr.o-cl.o)/g;
    CP ver = hor*CP(cosl(PI*0.5L), sinl(PI*0.5L));
    for(int s : {-1, 1}) {
        long double h = (cl.r + (long double)s*cr.r)/g;
        if(abs(1-h*h) <= EPS) {
            // 2円が接しているときの共通接線
            res.emplace_back(cl.o + hor*cl.r, cl.o + (hor+ver)*cl.r);
        }else if(1-h*h > 0) {
            // 内側に引かれる2接線+外側に引かれる2接線
            CP nhor = hor*h, nver = ver*sqrtl(1-h*h);
            res.emplace_back(cl.o + (nhor+nver)*cl.r, 
                             cr.o - (nhor+nver)*(cr.r*(long double)s));
            res.emplace_back(cl.o + (nhor-nver)*cl.r, 
                             cr.o - (nhor-nver)*(cr.r*(long double)s));
        }
    }
    return res;
}

// 三角形の内接円
Circle inscribed_circle(CP A, CP B, CP C) {
    if(cross(B-A, C-A) < 0) swap(B, C);
    long double a = abs(B-C), b = abs(C-A), c = abs(A-B);
    long double alpha = acosl((b*b+c*c-a*a)/(2.0L*b*c));
    long double beta = acosl((c*c+a*a-b*b)/(2.0L*c*a));
    // AとxABを通る直線とBとxBCを通る直線の交点が内心
    CP I = intersection_line(A, A+translate(B-A, alpha/2.0L), B, B+translate(C-B, beta/2.0L));
    // ABとIの最短距離が内心半径
    long double Ir = distance_lines_p(A, B, I);
    return Circle(I, Ir);
}

// 三角形の外接円
Circle circumscribed_circle(CP A, CP B, CP C) {
    // 2つの垂直二等分線の交点
    Line AB = vertical_bisector(A, B);
    Line BC = vertical_bisector(B, C);
    CP O = intersection_line(AB.s, AB.t, BC.s, BC.t);
    long double Or = abs(A-O);
    return Circle(O, Or);
}

// 2円の共通面積
long double common_area(Circle cl, Circle cr) {
    if(cl.r < cr.r) swap(cl, cr);
    int num = is_cross_circles(cl, cr);
    if(num >= 3) return 0.0L;
    if(num >= 1) return PI*cr.r*cr.r;
    if(num < 0) return PI*cl.r*cl.r;
    long double d = abs(cl.o-cr.o);
    long double res = 0.0L;
    for(int i = 0; i < 2; ++i) {
        long double theta = 2.0L * acosl((d*d+cl.r*cl.r-cr.r*cr.r)/(2.0L*d*cl.r));
        res += (theta-sinl(theta))*cl.r*cl.r/2.0L;
        swap(cl, cr);
    }
    return res;
}

// 円と多角形の共通面積
long double common_area(Polygon p, Circle c) {
    if(p.size() < 3) return 0.0L;
    function<long double(Circle, CP, CP)> dfs = [&](Circle c, CP a, CP b) {
        CP va = c.o-a, vb = c.o-b;
        long double f = cross(va, vb), res = 0;
        if(EQ(f, 0.0)) return res;
        if(max(abs(va), abs(vb)) < c.r+EPS) return f;
        CP d(dot(va, vb), cross(va, vb));
        if(distance_lines_p(a, b, c.o) > c.r-EPS) {
            return c.r*c.r*(atan2(d.imag(), d.real()));
        }
        auto u = intersection_circle_line(c, a, b);
        if(u.empty()) return res;
        if(u.size() > 1 && dot(u[1]-u[0], a-u[0]) > 0) swap(u[0], u[1]);
        u.emplace(u.begin(), a);
        u.emplace_back(b);
        for(int i = 1; i < (int)u.size(); ++i) res += dfs(c, u[i-1], u[i]);
        return res;
    };
    long double res = 0.0L;
    for(int i = 0; i < (int)p.size(); ++i) res += dfs(c, p[i], p[(i+1)%p.size()]);
    return res/2;
}

// 3点の位置関係を判定
int calc_clockwise(CP p0, CP p1, CP p2) {
    CP x = p1-p0, y = p2-p0;
    if(cross(x, y) > EPS) return 1;     // "COUNTER_CLOCKWISE"
    if(cross(x, y) < -EPS) return -1;   // "CLOCKWISE"
    if(dot(x, y) < 0) return 2;         // "ONLINE_BACK"
    if(norm(x) < norm(y)) return -2;    // "ONLINE_FRONT"
    return 0;                           // "ON_SEGMENT" 
}

int n;
long double w;
struct xyz {
    CP pos;
    long double z;
};

int main() {
    while(1) {
        cin >> n >> w;
        if(n == 0 && w == 0) break;
        vector<xyz> needles;
        for(int i = 0; i < n; ++i) {
            long double x, y, h;
            cin >> x >> y >> h;
            xyz indata;
            indata.pos = CP(x, y);
            indata.z = h;
            needles.emplace_back(indata);
        } 

        // (0,0), (0,100), (100,0), (100,100)に囲まれている
        // 針を中心とした円の交点と4隅から半径r縮小した正方形との交点が候補になる
        long double low = 0.0L, high = 1e9;
        for(int i = 0; i < 100; ++i) {
            long double mid = (low+high)/2.0L;
            auto isOK = [&](long double R) {
                // 2分探索用のチェック
                vector<Circle> cs(n);
                for(int i = 0; i < n; ++i) {
                    if(needles[i].z <= R) cs[i].r = sqrtl(2.0L*R*needles[i].z - needles[i].z*needles[i].z);
                    else cs[i].r = R;
                    cs[i].o = needles[i].pos;
                }

                long double margin = (w <= R ? sqrtl(2.0L*R*w - w*w) : R);
                if(margin >= 50.0L) return false;   // 半径が50を超えることはない

                vector<Segment> ss;
                ss.emplace_back(Segment(CP(margin, margin), CP(100.0L-margin)));
                ss.emplace_back(Segment(CP(margin, margin), CP(margin, 100.0L-margin)));
                ss.emplace_back(Segment(CP(100.0L-margin, margin), CP(100.0L-margin, 100.0L-margin)));
                ss.emplace_back(Segment(CP(margin, 100.0L-margin), CP(100.0L-margin, 100.0L-margin)));

                vector<CP> ps;      // 調べるべき交点
                // 小さい正方形の4隅
                ps.emplace_back(CP(margin, margin));
                ps.emplace_back(CP(margin, 100.0L-margin));
                ps.emplace_back(CP(100.0L-margin, margin));
                ps.emplace_back(CP(100.0L-margin, 100.0L-margin));

                // 円と正方形の交点を列挙する
                for(int i = 0; i < n; ++i) {
                    for(int j = 0; j < 4; ++j) {
                        vector<CP> inps = intersection_circle_line(cs[i], ss[j].s, ss[j].t);
                        for(auto p : inps) ps.emplace_back(p);
                    }
                }
                for(int i = 0; i < n; ++i) {
                    for(int j = i+1; j < n; ++j) {
                        vector<CP> inps = intersection_circle_circle(cs[i], cs[j]);
                        for(auto p : inps) ps.emplace_back(p);
                    }
                }

                bool ok = false;
                for(auto p : ps) {
                    bool flg = true;
                    for(int i = 0; i < n; ++i) {
                        if(abs(p-cs[i].o) < cs[i].r-EPS) flg = false;
                    }
                    if(flg) {
                        if(p.real() >= margin-EPS && p.real()-EPS <= 100.0L-margin &&
                           p.imag() >= margin-EPS && p.imag()-EPS <= 100.0L-margin) {
                               ok = true;
                        }
                    }
                }
                return ok;
            };
            if(isOK(mid)) low = mid;
            else high = mid;
        }

        cout << fixed << setprecision(5) << low << endl;
    }
}
accuracy: 1
time_ms: 7810
memory_kb: 3568
final_rank: 18

code_snippet: #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

ll mod_pow(ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%mod;
		a = a * a%mod; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//ll inv(ll a, ll p) {
//	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
//}
//modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

using Point = complex<ld>;
ld dot(Point a, Point b) { return real(conj(a)*b); }
ld cross(Point a, Point b) { return imag(conj(a)*b); }
struct Line {
	Point a, b;
};
struct Circle {
	Point p; ld r;
};

Point proj(Line l, Point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}
ld dist_lp(Line l, Point p) {
	return abs(p - proj(l, p));
}

vector<Point> is_lc(Circle c, Line l) {
	vector<Point> res;
	ld d = dist_lp(l, c.p);
	if (d > c.r + eps)return res;
	ld len = (d > c.r) ? 0.0 : sqrt(c.r*c.r - d * d);
	Point nor = (l.a - l.b) / abs(l.a - l.b);
	res.push_back(proj(l, c.p) + len * nor);
	res.push_back(proj(l, c.p) - len * nor);
	return res;
}
vector<Point> is_cc(Circle c1, Circle c2) {
	vector<Point> res;
	ld d = abs(c1.p - c2.p);
	ld rc = (d*d + c1.r*c1.r - c2.r*c2.r) / (2 * d);
	ld dfr = c1.r*c1.r - rc * rc;
	if (abs(dfr) < eps)dfr = 0.0;
	if (dfr < 0.0)return res;
	ld rs = sqrt(dfr);
	Point diff = (c2.p - c1.p) / d;
	res.push_back(c1.p + diff * Point(rc, rs));
	if (dfr != 0.0)res.push_back(c1.p + diff * Point(rc, -rs));
	return res;
}

bool is_in(Circle c, Point p) {
	ld dist = abs(c.p - p);
	return dist < c.r;
}

int n;ld w;
int x[10], y[10], h[10];
Circle c[10];

bool can(ld r) {
	ld le;
	if (r < w)le = r;
	else {
		le = sqrt(pow(r, 2) - pow(r - w, 2));
	}
	if (le >= 50)return false;
	rep(i, n) {
		c[i].p = { (ld)x[i],(ld)y[i] };
		if (r < h[i])c[i].r = r;
		else c[i].r = sqrt(pow(r, 2) - pow(r - h[i], 2));
	}

	ld ri = 100 - le;
	Point p[4] = { {le,le},{le,ri},{ri,le},{ri,ri} };
	Line l[4] = { {p[0],p[1]},{p[0],p[2]},{p[3],p[1]},{p[3],p[2]} };
	rep(i, 4) {
		bool f = true;
		rep(j, n) {
			if (is_in(c[j], p[i])) {
				f = false; break;
			}
		}
		if (f)return true;
	}
	rep(i, 4) {
		rep(j, n) {
			vector<Point> v = is_lc(c[j], l[i]);
			rep(k, v.size()) {
				
				if (real(v[k]) < le || real(v[k])>ri)continue;
				if (imag(v[k]) < le || imag(v[k]) > ri)continue;
				bool f = true;
				rep(l, n) {
					if (l == j)continue;
					if (is_in(c[l], v[k])) {
						f = false; break;
					}
				}
				if (f)return true;
			}
		}
	}
	rep(i, n)Rep(j,i+1, n) {
		vector<Point> v = is_cc(c[i], c[j]);
		rep(k, v.size()) {
			if (real(v[k]) < le || real(v[k])>ri)continue;
			if (imag(v[k]) < le || imag(v[k]) > ri)continue;
			bool f = true;
			rep(l, n) {
				if (l == i || l == j)continue;
				if (is_in(c[l], v[k])) {
					f = false; break;
				}
			}
			if (f)return true;
		}
	}
	return false;
}
void solve() {
	cin >> w;
	rep(i, n) {
		cin >> x[i] >> y[i] >> h[i];
	}
	ld le = 0, ri = (w*w+2500)/(2*w);
	rep (aa,100) {
		ld mid = (le + ri) / 2;
		if (can(mid))le = mid;
		else ri = mid;
	}
	cout << le << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(5);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	while (cin >> n, n)solve();
	//solve();
	stop
		return 0;
}
accuracy: 1
time_ms: 550
memory_kb: 3304
final_rank: 3

code_snippet: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i< (n);i++)
using namespace std;
typedef long long ll;
typedef pair<double,double> P;
const double EPS = 1e-8;

//補助用演算関数を作っとく.
double dist(P x,P y){
    double x1=x.first,x2=x.second,y1=y.first,y2=y.second;
    double tmp=(x1-y1)*(x1-y1)+(x2-y2)*(x2-y2);
    return sqrt(tmp);
}
double grp(double x,double y){
    //斜辺と一辺が与えられたときにもう一個の辺の長さを返す関数。
    //初めから作っておくべきであった.
    //xを斜辺とする.
    double ans = x*x-y*y;
    if(ans<0){
        cout<<"error!"<<endl;
        cout<<x<<' '<<y<<endl;
        //円同士の交点の演算の時にerrorが出ていた.おそらくすっぽり入ってるときか？
        //やはり円の交点のところを直したらerrorが出なかったので元凶は円.
        //円と壁のバグなしたのにまだ駄目だ。。。
    }
    return sqrt(ans);
}

int main(){
    while(true){
        int n,w;cin>>n>>w;
        if(n==0 && w==0)break;
        vector<pair<P,double>> lst(n);
        rep(i,n){
            double x,y,h;cin>>x>>y>>h;
            lst[i] = make_pair(make_pair(x,y),h);
        }
        //まずは交点を全て求める.
        //これらは全てt_midを与えられて計算する.
        //つまりjudge内で書く必要がある.
        auto judge=[&](double t_mid){
            vector<P> cross_lst;
            double w_now;
            if(w < t_mid)w_now=grp(t_mid,(t_mid-w));
            else w_now=t_mid;
            //円同士の交点を求める
            for(int i=0;i<n-1;i++){
                for(int j=i+1;j<n;j++){
                    //円の全ての組み合わせを試す.
                    pair<P,double> r1 = lst[i];
                    pair<P,double> r2 = lst[j];
                    //半径は修正.
                    double r1_now;
                    if(r1.second < t_mid)r1_now=grp(t_mid,(t_mid-r1.second));
                    else r1_now=t_mid;
                    double r2_now;
                    if(r2.second < t_mid)r2_now=grp(t_mid,(t_mid-r2.second));
                    else r2_now=t_mid;
                    //交点を持たない場合はここでcontinue↓
                    double dis = dist(r1.first,r2.first);
                    //判定します.
                    if(abs(r1_now-r2_now) > dis || (r1_now+r2_now) < dis)continue;
                    double a = (dis*dis+r1_now*r1_now-r2_now*r2_now)/2;
                    double b = dis*dis*r1_now*r1_now-a*a;
                    double x1 = r2.first.first,x0 = r1.first.first,y1=r2.first.second,y0=r1.first.second;
                    P tg1 = make_pair(((a*(x1-x0)+(y1-y0)*sqrt(b))/(dis*dis)+x0),((a*(y1-y0)-(x1-x0)*sqrt(b))/(dis*dis)+y0));
                    P tg2 = make_pair(((a*(x1-x0)-(y1-y0)*sqrt(b))/(dis*dis)+x0),((a*(y1-y0)+(x1-x0)*sqrt(b))/(dis*dis)+y0));
                    cross_lst.push_back(tg1);
                    cross_lst.push_back(tg2);
                    //done
                }
            }
            
            //次、壁と円の交点を求める.
            rep(i,n){
                pair<P,double> r=lst[i];
                //下の壁との交点
                double r_now;
                if(r.second < t_mid)r_now=grp(t_mid,(t_mid-r.second));
                else r_now=t_mid;
                double distwithwall = abs(r.first.second-w_now);
                if(distwithwall<=r_now){
                P tg1 = make_pair((r.first.first+grp(r_now,distwithwall)),w_now);
                P tg2 = make_pair((r.first.first-grp(r_now,distwithwall)),w_now);
                cross_lst.push_back(tg1);
                cross_lst.push_back(tg2);
                }
                //上の壁との交点
                distwithwall = abs(r.first.second-(100-w_now));
                if(distwithwall<=r_now){
                P tg1 = make_pair((r.first.first+grp(r_now,distwithwall)),100-w_now);
                P tg2 = make_pair((r.first.first-grp(r_now,distwithwall)),100-w_now);
                cross_lst.push_back(tg1);
                cross_lst.push_back(tg2);
                }
                //左の壁との交点
                distwithwall = abs(r.first.first-w_now);
                if(distwithwall<=r_now){
                P tg1 = make_pair(w_now,(r.first.second+grp(r_now,distwithwall)));
                P tg2 = make_pair(w_now,(r.first.second-grp(r_now,distwithwall)));
                cross_lst.push_back(tg1);
                cross_lst.push_back(tg2);
                }
                //右の壁との交点
                distwithwall = abs(r.first.first-(100-w_now));
                if(distwithwall<=r_now){
                P tg1 = make_pair(100-w_now,(r.first.second+grp(r_now,distwithwall)));
                P tg2 = make_pair(100-w_now,(r.first.second-grp(r_now,distwithwall)));
                cross_lst.push_back(tg1);
                cross_lst.push_back(tg2);
                }
            }
            //最後に、壁同士の交点を入れておく.
            cross_lst.push_back(make_pair(w_now,w_now));
            cross_lst.push_back(make_pair(100-w_now,w_now));
            cross_lst.push_back(make_pair(w_now,100-w_now));
            cross_lst.push_back(make_pair(100-w_now,100-w_now));

            //次に、交点が存在できるかチェック!!
            int cnt = 0;//ダメだった交点数.これが全部ならout.
            for(P target : cross_lst){
                //壁の内側に入っているかcheck!
                if(w_now>target.first+EPS || target.first>(100-w_now)+EPS || w_now>target.second+EPS || target.second+EPS>(100-w_now)){
                    cnt++;
                    continue;
                }
                //円の内部に入らないかチェック!
                rep(i,n){
                    pair<P,double> r = lst[i];
                    double r_now;
                    if(r.second < t_mid)r_now=grp(t_mid,(t_mid-r.second));
                    else r_now=t_mid;
                    if(dist(r.first,target)+EPS<r_now){
                        cnt++;
                        break;
                    }
                }
            }
            if(cnt == cross_lst.size())return false;
            return true;
        };
        //judgeが描き終わったので二分探索をする.
        double t_min = 0;//ok
        double t_max = (1e+9)+5;//絶対out
        const double D = 1e-6;
        while(t_min+D<t_max){
            double t_mid=(t_min+t_max)/2;
            if(judge(t_mid)){
                t_min = t_mid;
            }else{
                t_max = t_mid;
            }
        }
        cout<<fixed<<setprecision(6)<<t_min<<endl;
    }
    return 0;
}
accuracy: 1
time_ms: 50
memory_kb: 3244
final_rank: 1