#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-10;
typedef int weight;
struct edge
{
	int to; weight cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
typedef vector<vector<edge>> Graph;
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

struct data{ double minx, miny, maxx, maxy, h; };
int n;
vector<data> v;

typedef long double ld;
const double PI = acos(-1.0);
bool eq(double a, double b) { return fabs(a - b) < EPS; }
typedef complex<double> Point;
typedef vector<Point> Polygon;

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

struct Line
{
	Point a, b;
	Line(Point p, Point q) :a(p), b(q) {};
	Line(double x1, double y1, double x2, double y2) :a(Point(x1, y1)), b(Point(x2, y2)) {};
};

struct Circle
{
	Point p; double r;
	Circle(Point a, double b) :p(a), r(b) {};
};

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

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

int ccw(Point a, Point b, Point c)
{
	b -= a; c -= a;
	if (cross(b, c) > EPS) return 1;    //counter cloclwise
	if (cross(b, c) < -EPS) return -1;  //cloclwise
	if (dot(b, c) < 0) return 2;        //c--a--b on line 
	if (norm(b) < norm(c)) return -2;   //a--b--c on line
	return 0;                           //a--c--b on line
}

bool isis_sp(Line s, Point p)
{
	return (abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a)) < EPS;
}

Point projection(Line l, Point p)
{
	Point base = l.b - l.a;
	double r = dot(p - l.a, base) / norm(base);
	return l.a + base*r;
}

double dist_sp(Line s, Point p)
{
	Point r = projection(s, p);
	if (isis_sp(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

bool isis_ss(Line s, Line 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);
}

double dist_ss(Line s, Line t)
{
	if (isis_ss(s, t)) return 0;
	return min(min(dist_sp(s, t.a), dist_sp(s, t.b)), min(dist_sp(t, s.a), dist_sp(t, s.b)));
}

bool check(double r, Line s)
{
	bool ans = true;
	REP(i, v.size())
	{
		data t = v[i];
		if (s.a.real() - t.minx > -EPS && t.maxx - s.a.real() > -EPS &&
			s.a.imag() - t.miny > -EPS && t.maxy - s.a.imag() > -EPS) ans = false;
		if (s.b.real() - t.minx > -EPS && t.maxx - s.b.real() > -EPS &&
			s.b.imag() - t.miny > -EPS && t.maxy - s.b.imag() > -EPS) ans = false;
		Point ps[4] = { Point(t.maxx, t.maxy), Point(t.maxx, t.miny), Point(t.minx, t.miny), Point(t.minx, t.maxy)};
		REP(j, 4)
		{
			Line ts = Line(ps[j], ps[(j + 1) % 4]);
			if (isis_ss(s, ts)) ans = false;
			double d = dist_ss(s, ts);
			if (t.h-r>-EPS && d - r < EPS) ans = false;
			double dd = sqrt(pow(r - t.h, 2) + d*d);
			if (dd - r < -EPS) ans = false;
		}
	}
	return ans;
}

int main()
{
	while (cin >> n, n)
	{
		double sx, sy, ex, ey;
		cin >> sx >> sy >> ex >> ey;
		Line s(sx, sy, ex, ey);
		v.clear();
		REP(i, n)
		{
			double a, b, c, d, e;
			cin >> a >> b >> c >> d >> e;
			v.push_back(data{ a, b, c, d, e });
		}
		double lb = 0, ub = 1000;
		REP(i, 100)
		{
			double mid = (lb + ub) / 2;
			if (check(mid, s)) lb = mid;
			else ub = mid;
		}
		cout << D10 << ub << endl;
	}
	return 0;
}

Measured memory_bytes: 1328