// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) begin(V), end(V)
#define ALLR(V) rbegin(V), rend(V)
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

const double eps = 1e-6;
const long double pi = 3.14159265358979323846264338327950288419716939937510L;

using Point = complex<double>;

struct DualPoints : public pair<Point, Point> {
    using pair<Point, Point>::pair;

    Point& operator [](size_t idx) { return idx == 0 ? first : second; }
    
    const Point& operator [](size_t idx) const { return idx == 0 ? first : second; }
};

struct get_xy {
    double &x, &y;

    get_xy(double &x, double &y) : x(x), y(y) { }

    get_xy& operator =(const Point &p) {
        x = real(p);
        y = imag(p);
        return *this;
    }
};

struct Line : public DualPoints {
    using DualPoints::DualPoints;
};

struct Seg : public DualPoints {
    using DualPoints::DualPoints;
};

double dot(const Point &a, const Point &b) {
    return (conj(a) * b).real();
}

double cross(const Point &a, const Point &b) {
    return (conj(a) * b).imag();
}

enum ccwd {
    Clock = -1,
    CoClock = 1,
    CAB = 2,
    ABC = -2,
    ACB = 0,
};

ccwd ccw(Point a, Point b, Point c) {
    b -= a;
    c -= a;
    double p, q;
    {
        auto tmp = conj(b) * c;
        p = tmp.real();
        q = tmp.imag();
    }
    if (0 < q) return CoClock;
    if (q < 0) return Clock;
    if (p < 0) return CAB;
    if (norm(b) < norm(c)) return ABC;
    return ACB;
}

bool is_zero(double a) {
    return abs(a) <= eps;
}

bool is_parallel(const Line &l1, const Line &l2) {
    return is_zero(cross(l1[1] - l1[0], l2[1] - l2[0]));
}

bool is_same_line(Point o, Point a, Point b) {
    return is_zero(cross(a - o, b - o));
}

bool intersect(const Line &p, const Line &q) {
    if (!is_parallel(p, q)) return true;
    return is_same_line(p[0], p[1], q[1]);
}

bool intersect(const Line &l, const Seg &s) {
    double a = cross(l[1] - l[0], s[0] - l[0]);
    double b = cross(l[1] - l[0], s[1] - l[0]);
    return a * b < 0;
}

bool intersect(const Seg &p, const Seg &q) {
    bool pf = (ccw(p[0], p[1], q[0]) * ccw(p[0], p[1], q[1])) <= 0;
    bool qf = (ccw(q[0], q[1], p[0]) * ccw(q[0], q[1], p[1])) <= 0;
    return pf && qf;
}

bool intersect(const Line &l, const Point &p) {
    return is_same_line(p, l[0], l[1]);
}

bool intersect(const Seg &s, const Point &p) {
    double l1 = abs(s[0] - s[1]);
    double l2 = abs(s[0] - p);
    double l3 = abs(s[1] - p);
    return is_zero(l2 + l3 - l1);
}

// projection from p to l
Point proj(const Line &l, const Point &p) {
    double mul = dot(p - l[0], l[1] - l[0]) / norm(l[0] - l[1]);  // cos(theta) / (p-l[0]).norm()
    return l[0] + mul * (l[1] - l[0]);
}

Point refl(const Line &l, const Point &p) {
    Point pr = proj(l, p);
    return p + (2. * (pr - p));
}

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

double distance(const Line &p, const Line &q) {
    if (is_parallel(p, q)) return distance(p, q[0]);
    return 0;
}

double distance(const Line &l, const Seg &s) {
    if (intersect(l, s)) return 0;
    return min(distance(l, s[0]), distance(l, s[1]));
}

double distance(const Seg &s, const Point &p) {
    Line l(s[0], s[1]);
    Point pr = proj(l, p);
    if (intersect(s, pr)) return abs(pr - p);
    return min(abs(s[0] - p), abs(s[1] - p));
}

double distance(const Seg &p, const Seg &q) {
    if (intersect(p, q)) return 0;
    return var_min(distance(p, q[0]), distance(p, q[1]),
                   distance(q, p[0]), distance(q, p[1]));
}

double fix_arg(double arg) {
    arg += 2 * pi;
    if (2 * pi <= arg) arg -= 2 * pi;
    return arg;
}

bool comp_coclock(const Point &p1, const Point &p2) {
    return fix_arg(arg(p1)) < fix_arg(arg(p2));
}

Point rotate(const Point &p, double arg) {
    complex<double> r(cos(arg), sin(arg));
    return p * r;
}

using Block = array<Seg, 4>;

bool judge(const Seg &crs, double r, double h, const Seg &seg) {
    double d = distance(seg, crs);
    double dz = r - min(r, h);
    return r * r <= d * d + dz * dz;
}

bool judge(const Seg &crs, double br, double h, const Block &b) {
    for (auto &&s : b) if (!judge(crs, br, h, s)) return false;
    return true;
}

bool input(V<pair<Block, double>> &blocks, const Seg &crs) {
    bool ret = true;
    for (auto &&e : blocks) {
        double l, r, d, u, h;
        cin >> l >> d >> r >> u >> h;
        Point bl[4] = {
            Point(l, u), Point(r, u),
            Point(r, d), Point(l, d),
        };
        ll idx = 0;
        for (ll i = 0; i < 4; i++) for (ll j = i + 1; j < 4; j++) {
            if (j - i == 2) continue;
            e.first[idx++] = Seg(bl[i], bl[j]);
        }
        if (intersect(crs, Seg(bl[0], bl[2])) ||
            intersect(crs, Seg(bl[1], bl[3]))) ret = false;
        e.second = h;
    }
    return ret;
}

bool solve() {
    ll N;
    cin >> N;
    if (!N) return false;
    double sx, sy, ex, ey;
    cin >> sx >> sy >> ex >> ey;
    V<pair<Block, double>> blocks(N);
    Seg crs(Point(sx, sy), Point(ex, ey));
    if (!input(blocks, crs)) {
        cout << 0 << endl;
        return true;
    }
    
    double ok = 0, ng = 1000;
    for (ll lp = 0; lp < 100; lp++) {
        double mid = (ok + ng) / 2;
        bool j = true;
        for (auto &&e : blocks) j &= judge(crs, mid, e.second, e.first);
        (j ? ok : ng) = mid;
    }
    cout << ok << endl;
    return true;
}

int main() {
    while (solve());
    return 0;
}



Measured memory_bytes: 3180