#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <complex>
#include <vector>

using namespace std;
static const double EPS = 1e-10;
static const double PI = acos(-1.0);

typedef complex<double> Point;
struct Line : public vector<Point> {
  Line(Point a, Point b) { push_back(a), push_back(b); }
};

inline double cross(Point a, Point b) {
  return imag(conj(a) * b);
}
inline double dot(Point a, Point b) {
  return real(conj(a) * b);
}
int ccw(Point a, Point b, Point c) {
  b -= a; c -=a;
  if (cross(b, c) > 0) { return 1; }
  if (cross(b, c) < 0) { return -1; }
  if (dot(b, c) < 0) { return 2; }
  if (norm(b) < norm(c)) { return -2; }
  return 0;
}

bool intersectSP(const Line &s, const Point &p) {
  return abs(s[0] - p) + abs(s[1] - p) - abs(s[0] - s[1]) < EPS;
}

bool intersectSS(const Line &s, const Line &t) {
  return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
         ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}

Point projection(const Line &l, const Point p) {
  double t = dot(p - l[0], l[0] - l[1]) / norm(l[0] - l[1]);
  return l[0] + t * (l[0] - l[1]);
}

double distanceSP(const Line &s, const Point &p) {
  const Point r = projection(s, p);
  if (intersectSP(s, r)) { return abs(r - p); }
  return min(abs(s[0] - p), abs(s[1] - p));
}

double distanceSS(const Line &s, const Line &t) {
  if (intersectSS(s, t)) { return 0; }
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define DEC(i, s) for (int i = (s); i >= 0; i--)

#define SIZE(v) (int)((v).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define FIND(m, w) ((m).find(w) != (m).end())

int n;
Point start, end;
Point box[100][4];
double height[100];

inline double square(double x) { return x * x; }
inline double dist(Line s, Line t, double r, double h) {
  return sqrt(square(distanceSS(s, t)) + square(r - h));
}

bool check(int i, int j, double r) {
  int pj = j;
  int nj = (j + 1) % 4;
  Line s(start, end);
  Line t(box[i][pj], box[i][nj]);
  if (dist(s, t, r, min(height[i], r)) <= r) { return true; }
  return false;
}

bool hit(double r) {
  REP(i, n) {
    REP(j, 4) {
      if (check(i, j, r)) { return true; }
    }
  }
  return false;
}

int main() {
  while (scanf("%d", &n), n) {
    double a, b, c, d, e;
    scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
    start = Point(a, b);
    end = Point(c, d);
    bool ok = true;
    REP(i, n) {
      scanf("%lf %lf %lf %lf %lf", &a, &b, &c, &d, &e);
      box[i][0] = Point(a, b);
      box[i][1] = Point(a, d);
      box[i][2] = Point(c, d);
      box[i][3] = Point(c, b);
      height[i] = e;
      if (start.real() >= a && start.real() <= c && start.imag() >= b && start.imag() <= d) {
        ok = false;
      }
    }
    if (!ok) {
      puts("0.00000");
      continue;
    }
    double l = 0.0;
    double r = 1000.0;
    REP(iter, 50) {
      double mid = (l + r) / 2.0;
      if (hit(mid)) {
        r = mid;
      } else {
        l = mid;
      }
    }
    printf("%.5lf\n", l);
  }
}

Measured memory_bytes: 1004