#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include <complex>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}


typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-9, pi = acos(-1.0);
namespace std {
  bool operator<(const Point &lhs, const Point &rhs) {
    if (lhs.real() < rhs.real() - eps) return true;
    if (lhs.real() > rhs.real() + eps) return false;
    return lhs.imag() < rhs.imag();
  }
}
class Line {
public:
  Point a, b;
  Line () : a(Point(0, 0)), b(Point(0, 0)) {}
  Line (Point a, Point b) : a(a), b(b) {}
};

ld dot(Point a, Point b) {
  return real(conj(a) * b);
}
ld 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;
  if (cross(b, c) < -eps) return -1;
  if (dot(b, c) < 0) return 2;
  if (norm(b) < norm(c)) return -2;
  return 0;
}
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);
}
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;
}
bool isis_sp (Line s, Point p) {
  return (abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps);
}

ld dist_sp (Line s, Point p) {
  Point r = proj(s, p);
  return isis_sp(s, r) ? abs(r - p) : min(abs(s.a - p), abs(s.b - p));
}

int main(){
	int n;
	Line la;
	Line lt[5];
	double da,db,dc,dd,de;
	int a,b,c,d;
	int i,j,k;
	int x,y;
	double s=0;
	while(cin>>n){
		if(!n)break;
		cin>>da>>db>>dc>>dd;
		la.a=Point(da,db),la.b=Point(dc,dd);
		x=da,y=db;
		s=1000.0;
		for(i=0;i<n;i++){
			cin>>da>>db>>dc>>dd>>de;
			lt[0].a=Point(da,db),lt[0].b=Point(da,dd);
			lt[1].a=Point(dc,db),lt[1].b=Point(dc,dd);
			lt[2].a=Point(da,db),lt[2].b=Point(dc,db);
			lt[3].a=Point(da,dd),lt[3].b=Point(dc,dd);
			if(isis_ss(la,lt[0]) || isis_ss(la,lt[1]) ||
			isis_ss(la,lt[2]) || isis_ss(la,lt[3])){
				s=0;
				continue;
			}
			if(da<=x && x<=dc && db<=y && y<=dd){
				s=0;
				continue;
			}
			long double dt[20]={dist_sp(la,Point(da,db)),dist_sp(la,Point(dc,db)),
			dist_sp(la,Point(da,dd)),dist_sp(la,Point(dc,dd)),
			dist_sp(lt[0],la.a),dist_sp(lt[0],la.b),
			dist_sp(lt[1],la.a),dist_sp(lt[1],la.b),
			dist_sp(lt[2],la.a),dist_sp(lt[2],la.b),
			dist_sp(lt[3],la.a),dist_sp(lt[3],la.b)};
			sort(dt,dt+12);
			da=dt[0];
			//cout<<"da"<<da<<endl;
			if(da<de)s=min(s,da);
			else s=min(s,(da*da+de*de)/(de*2.0));
		}
		cout<<fixed<<setprecision(5)<<s<<endl;
	}
}



Measured memory_bytes: 3268