#include <cstdio>
#include <complex>
#include <cmath>
#include <algorithm>
using namespace std;

typedef complex<double> P;
const int MAX_N = 59;
int N;
double SX, SY, GX, GY;
double minx[MAX_N], maxx[MAX_N], miny[MAX_N], maxy[MAX_N], hs[MAX_N], ds[MAX_N];
P S, G;

const double EPS = 1e-12;

double sq(double x){ return x*x; }

//??????
double dot(complex<double> l, complex<double> r){
    return real(conj(l)*r);
    //return l.real()*r.real() + l.imag()*r.imag();
}

//??????
double cross(complex<double> l, complex<double> r){
    return imag(conj(l)*r);
    // return l.real()*r.imag() - l.imag()*r.real();
}

//???????¨???????
bool ccw(complex<double> l, complex<double> r){
    double a = cross(l, r);
    if(a == 0)
        //???????????´????????????????????£?????????????¨???????
        return false;
    else
        return a > 0;
}


//???p??¨??´???(s, e)????????¢
double disLP(complex<double> s, complex<double> e, complex<double> p){
    return abs(cross(e-s,p-s))/abs(e-s);
}

//???p??¨??????(s, e)????????¢
double disSP(complex<double> s, complex<double> e, complex<double> p){
    if(dot(e-s, p-s)<=0)
        return abs(p-s);
    if(dot(s-e, p-e)<=0)
        return abs(p-e);
    return disLP(s, e, p);
}
    
bool crsSS(complex<double> s1, complex<double> e1, complex<double> s2, complex<double> e2){
    return (ccw(e1-s1, s2-s1)^ccw(e1-s1, e2-s1)) && (ccw(e2-s2, s1-s2)^ccw(e2-s2, e1-s2));
}


bool init(){
    for(int i=0; i<N; i++){
        if(crsSS(S,G,P(minx[i],miny[i]),P(minx[i],maxy[i])) ||
           crsSS(S,G,P(minx[i],miny[i]),P(maxx[i],miny[i])) ||
           crsSS(S,G,P(maxx[i],maxy[i]),P(minx[i],maxy[i])) ||
           crsSS(S,G,P(maxx[i],maxy[i]),P(maxx[i],miny[i]))){
            return false;
        }
        if(minx[i] <= SX && SX <= maxx[i] && miny[i] <= SY && SY <= maxy[i]){
            return false;
        }
        if(minx[i] <= GX && GX <= maxx[i] && miny[i] <= GY && GY <= maxy[i]){
            return false;
        }
    }
    
    for(int i=0; i<N; i++){
        ds[i] = 1e10;
        ds[i] = min(ds[i], disSP(S,G,P(minx[i],miny[i])));
        ds[i] = min(ds[i], disSP(S,G,P(minx[i],maxy[i])));
        ds[i] = min(ds[i], disSP(S,G,P(maxx[i],miny[i])));
        ds[i] = min(ds[i], disSP(S,G,P(maxx[i],maxy[i])));
        
        ds[i] = min(ds[i], disSP(P(minx[i],miny[i]),P(minx[i],maxy[i]),S));
        ds[i] = min(ds[i], disSP(P(minx[i],miny[i]),P(maxx[i],miny[i]),S));
        ds[i] = min(ds[i], disSP(P(maxx[i],maxy[i]),P(minx[i],maxy[i]),S));
        ds[i] = min(ds[i], disSP(P(maxx[i],maxy[i]),P(maxx[i],miny[i]),S));
        
        ds[i] = min(ds[i], disSP(P(minx[i],miny[i]),P(minx[i],maxy[i]),G));
        ds[i] = min(ds[i], disSP(P(minx[i],miny[i]),P(maxx[i],miny[i]),G));
        ds[i] = min(ds[i], disSP(P(maxx[i],maxy[i]),P(minx[i],maxy[i]),G));
        ds[i] = min(ds[i], disSP(P(maxx[i],maxy[i]),P(maxx[i],miny[i]),G));
    }
    
    return true;
}

bool check(double r){
    for(int i=0; i<N; i++){
        if(ds[i] < sqrt(sq(r) - sq(r-min(r,hs[i])))){
            return false;
        }
    }
    return true;
}

double solve(){
    if(!init()){
        return 0;
    }
    double low = 0.0, high = 1009;
    for(int i=0; i<100; i++){
        double mid = (low + high)*0.5;
        if(check(mid)) low = mid;
        else high = mid;
    }
    return low;
}

int main(){
    while(scanf("%d",&N),N){
        scanf("%lf%lf%lf%lf",&SX,&SY,&GX,&GY);
        S = P(SX,SY); G = P(GX,GY);
        for(int i=0; i<N; i++){
            scanf("%lf%lf%lf%lf%lf",minx+i,miny+i,maxx+i,maxy+i,hs+i);
        }
        printf("%.7f\n",solve());
    }
    return 0;
}

Measured memory_bytes: 1104