#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 55
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.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 lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	Point operator - (){
		return Point(-x,-y);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y < p.y;
		else return x < p.x;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){ return a.x * b.x + a.y * b.y; }
double det(Vector a,Vector b){ return a.x * b.y - a.y * b.x; }
struct Obstacle{
	double minx,miny,maxx,maxy;
	double h;
};
int ccw(Point p,Segment l){
	if(det(l.p2 - l.p1,p - l.p1) > EPS) return 1;
	if(det(l.p2 - l.p1,p - l.p1) < -EPS) return -1;
	if(dot(l.p2 - l.p1,p - l.p1) < -EPS) return 2;
	if((l.p2 - l.p1).norm() < (p - l.p1).norm()) return -2;
	return 0;
}
bool cross(Segment s1,Segment s2){
	return ccw(s1.p1,s2) * ccw(s1.p2,s2) <= 0 && ccw(s2.p1,s1) * ccw(s2.p2,s1) <= 0;
}
double dis2(Point p,Segment s){//dis ^ 2.
	if(dot(p - s.p1,s.p2 - s.p1) < -EPS) return (p - s.p1).norm();
	if(dot(p - s.p2,s.p1 - s.p2) < -EPS) return (p - s.p2).norm();
	double tmp = abs(det(p - s.p1,s.p2 - s.p1));
	return tmp * tmp / (s.p2 - s.p1).norm();
}
double dis(double r,Segment s,Segment t,double h){
	if(cross(s,t)) return 0.0;
	double hori2 = min(min(dis2(s.p1,t),dis2(s.p2,t)),min(dis2(t.p1,s),dis2(t.p2,s)));
	if(r <= h) return sqrt(hori2);
	return sqrt(hori2 + (r - h) * (r - h));
}
double dis(double r,Segment s,Obstacle a){
	if(a.minx < s.p1.x + EPS && s.p1.x < a.maxx + EPS && a.miny < s.p1.y + EPS && s.p1.y < a.maxy + EPS) return 0.0;
	double res = 1e9;
	res = min(res,dis(r,s,Segment(Point(a.minx,a.miny),Point(a.minx,a.maxy)),a.h));
	res = min(res,dis(r,s,Segment(Point(a.minx,a.miny),Point(a.maxx,a.miny)),a.h));
	res = min(res,dis(r,s,Segment(Point(a.minx,a.maxy),Point(a.maxx,a.maxy)),a.h));
	res = min(res,dis(r,s,Segment(Point(a.maxx,a.miny),Point(a.maxx,a.maxy)),a.h));
	return res;
}
Obstacle rec[maxn];
Segment s;
int n;
bool check(double x){
	for(int i=1;i<=n;i++){
		if(dis(x,s,rec[i]) < x - EPS) return false;
	}
	return true;
}
int main(){
	while(~scanf("%d",&n) && n){
		scanf("%lf%lf%lf%lf",&s.p1.x,&s.p1.y,&s.p2.x,&s.p2.y);
		for(int i=1;i<=n;i++){
			scanf("%lf%lf%lf%lf%lf",&rec[i].minx,&rec[i].miny,&rec[i].maxx,&rec[i].maxy,&rec[i].h);
		}
		double lb = 0.0,rb = 5e4;
		for(int i=1;i<=35;i++){
			double mid = (lb + rb) / 2;
			if(check(mid)) lb = mid;
			else rb = mid;
		}
		printf("%.5f\n",lb);
	}
	return 0;
}

