#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int n;
int sx,sy,gx,gy;
int xa[SIZE],ya[SIZE],xb[SIZE],yb[SIZE],h[SIZE];

typedef complex<double> P;

//??????
double dot(P a, P b) {
  return (a * conj(b)).real();
}

//??????
double cross(P a, P b) {
  return (a * conj(b)).imag();
}

double distance_ls_p(P a, P b, P c) {
  if ( dot(b-a, c-a) < 1e-8 ) return abs(c-a);
  if ( dot(a-b, c-b) < 1e-8 ) return abs(c-b);
  return abs(cross(b-a, c-a)) / abs(b-a);
}

/* ?????????????????? */
bool IntersectionSS(P p1,P p2, P p3, P p4){
  long long a,b,c,d;
    
  //??????(x1,y1,x2,y2) ??¨ ??´???(x3,y3,x4,y4)
  a=(long long)(p3.real()-p4.real())*(p1.imag()-p3.imag())+
    (long long)(p3.imag()-p4.imag())*(p3.real()-p1.real());
  b=(long long)(p3.real()-p4.real())*(p2.imag()-p3.imag())+
    (long long)(p3.imag()-p4.imag())*(p3.real()-p2.real());

  //??????(x3,y3,x4,y4) ??¨ ??´???(x1,y1,x2,y2)
  c=(long long)(p1.real()-p2.real())*(p3.imag()-p1.imag())+
    (long long)(p1.imag()-p2.imag())*(p1.real()-p3.real());
  d=(long long)(p1.real()-p2.real())*(p4.imag()-p1.imag())+
    (long long)(p1.imag()-p2.imag())*(p1.real()-p4.real());
  
  if((a<0)^(b<0) && (c<0)^(d<0))
    return true;
  else
    return false;
}

bool check(double r){
  
  P l_s = P(sx,sy);
  P l_g = P(gx,gy);
  
  for(int i=0;i<n;i++){
    P p[4];
    p[0] = P(xa[i],ya[i]);
    p[1] = P(xa[i],yb[i]);
    p[2] = P(xb[i],yb[i]);
    p[3] = P(xb[i],ya[i]);
    double H = min((double)h[i],r);
    double R = sqrt(r*r - (r-H)*(r-H));

    for(int j=0;j<4;j++){
      double dis = distance_ls_p(l_s, l_g, p[j]);
      bool is = IntersectionSS(l_s,l_g,p[j],p[(j+1)%4]);
      bool in = (xa[i] <= sx && sx <= xb[i] && ya[i] <= sy && sy <= yb[i]) ||
        (xa[i] <= gx && gx <= xb[i] && ya[i] <= gy && gy <= yb[i]);
      
      if(dis < R || is || in){
        return false;
      }
    }
  }
  
  for(int i=0;i<n;i++){
    P p[4];
    p[0] = P(xa[i],ya[i]);
    p[1] = P(xa[i],yb[i]);
    p[2] = P(xb[i],yb[i]);
    p[3] = P(xb[i],ya[i]);
    double H = min((double)h[i],r);
    double R = sqrt(r*r - (r-H)*(r-H));

    for(int j=0;j<4;j++){
      double dis1 = distance_ls_p(p[j],p[(j+1)%4],l_s);
      double dis2 = distance_ls_p(p[j],p[(j+1)%4],l_g);
      
      if(dis1 < R || dis2 < R){
        return false;
      }
    }

  }
  
  return true;
}

bool solve(){
  
  
  scanf("%d",&n);

  if(n == 0) return false;

  scanf("%d%d%d%d",&sx,&sy,&gx,&gy);

  for(int i=0;i<n;i++){
    scanf("%d%d%d%d%d",xa+i, ya+i, xb+i, yb+i, h+i);
  }

  double l=0, r=1000;

  while(r-l > 1e-8){
    double mid = (l+r)/2;

    if(check(mid)){
      l = mid;
    }else{
      r = mid;
    }
  }

  printf("%.7lf\n",l);
  
  return true;
}

int main(){

  while(solve());
  
  return 0;
}

Measured memory_bytes: 3212