#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;
const double EPS = 1e-9;

struct Point {
	double x, y;
	Point() : x(0), y(0) { }
	Point(double x, double y) : x(x), y(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*(double s) const { return Point(x * s, y * s); }
	Point operator/(double s) const { return Point(x / s, y / s); }
	Point &operator+=(const Point &p){ x += p.x; y += p.y; return *this; }
	Point &operator-=(const Point &p){ x -= p.x; y -= p.y; return *this; }
	Point &operator*=(double s){ x *= s; y *= s; return *this; }
	Point &operator/=(double s){ x /= s; y /= s; return *this; }
	bool operator==(const Point &p) const { return x == p.x && y == p.y; }
	bool operator!=(const Point &p) const { return x != p.x || y != p.y; }
	bool operator<(const Point &p) const {
		return (x == p.x) ? (y < p.y) : (x < p.x);
	}
};
inline Point operator*(double s, const Point &p){ return p * s; }

inline double norm(const Point &p){ return p.x * p.x + p.y * p.y; }
inline double abs(const Point &p){ return sqrt(norm(p)); }
inline double cross(const Point &a, const Point &b){
	return a.x * b.y - a.y * b.x;
}
inline double dot(const Point &a, const Point &b){
	return a.x * b.x + a.y * b.y;
}
inline int ccw(const Point &a, const Point &b, const Point &c){
	const Point d = b - a, e = c - a;
	if(cross(d, e) > 0.0){ return 1; }
	if(cross(d, e) < 0.0){ return -1; }
	if(dot(d, e) < 0.0){ return 2; }
	if(abs(d) < abs(e)){ return -2; }
	return 0;
}

struct Line {
	Point a, b;
	Line() : a(), b() { }
	Line(const Point &a, const Point &b) : a(a), b(b) { }
	bool operator==(const Line &l) const { return a == l.a && b == l.b; }
	bool operator!=(const Line &l) const { return a != l.a || b != l.b; }
	bool operator<(const Line &l) const {
		return (a == l.a) ? (b < l.b) : (a < l.a);
	}
};

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

struct Segment : public Line {
	Segment() : Line() { }
	Segment(const Point &a, const Point &b) : Line(a, b) { }
};

inline bool intersect(const Segment &s, const Point &p){
	return abs(s.a - p) + abs(s.b - p) < abs(s.a - s.b) + EPS;
}
inline bool intersect(const Segment &a, const Segment &b){
	if(ccw(a.a, a.b, b.a) * ccw(a.a, a.b, b.b) > 0){ return false; }
	if(ccw(b.a, b.b, a.a) * ccw(b.a, b.b, a.b) > 0){ return false; }
	return true;
}
inline double dist(const Segment &s, const Point &p){
	const Point r = projection(s, p);
	if(intersect(s, r)){ return abs(r - p); }
	return min(abs(s.a - p), abs(s.b - p));
}
inline double dist(const Segment &a, const Segment &b){
	if(intersect(a, b)){ return 0; }
	const double x = min(dist(b, a.a), dist(b, a.b));
	const double y = min(dist(a, b.a), dist(a, b.b));
	return min(x, y);
}

inline bool between(double a, double b, double c){
	return a <= b && b <= c;
}

struct Block {
	double x0, y0, x1, y1, h;
};

int main(){
	ios_base::sync_with_stdio(false);
	cout << setprecision(10) << setiosflags(ios::fixed);
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		Segment path;
		cin >> path.a.x >> path.a.y >> path.b.x >> path.b.y;
		const double sx = path.a.x, sy = path.a.y;
		vector<Block> blocks(n);
		for(int i = 0; i < n; ++i){
			Block &b = blocks[i];
			cin >> b.x0 >> b.y0 >> b.x1 >> b.y1 >> b.h;
		}
		double left = 0.0, right = 1000.0;
		for(int iter = 0; iter < 100; ++iter){
			const double center = (left + right) * 0.5;
			bool accept = true;
			for(int i = 0; accept && i < n; ++i){
				const Block &b = blocks[i];
				if(between(b.x0, sx, b.x1) && between(b.y0, sy, b.y1)){
					accept = false;
					break;
				}
				const double r = center, h = b.h;
				const double limit = (r > h) ? sqrt(2 * r * h - h * h) : r;
				const Point p0(b.x0, b.y0);
				const Point p1(b.x1, b.y0);
				const Point p2(b.x1, b.y1);
				const Point p3(b.x0, b.y1);
				if(dist(path, Segment(p0, p1)) < limit){ accept = false; }
				if(dist(path, Segment(p1, p2)) < limit){ accept = false; }
				if(dist(path, Segment(p2, p3)) < limit){ accept = false; }
				if(dist(path, Segment(p3, p0)) < limit){ accept = false; }
			}
			if(accept){
				left = center;
			}else{
				right = center;
			}
		}
		cout << left << endl;
	}
	return 0;
}

Measured memory_bytes: 1320