#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

struct Vector {
	int x, y;
	double length() const { return std::sqrt(x * x + y * y); }
	int cross(const Vector& that) const { return x * that.y - y * that.x; }
	int dot(const Vector& that) const { return x * that.x + y * that.y; }
};
struct Coordinate {
	int x, y;
	Vector operator-(const Coordinate& that) const { return Vector{ x - that.x, y - that.y }; }
	double distance_from(const Coordinate& that) const { return ((*this) - that).length(); }
};
int sign(const int n) {
	return (n >= 0) ? 1 : -1;
}
struct Line {
	Coordinate from, to;
	double min_distance(const Line& that) const;
	double min_distance(const Coordinate& that) const;
	bool is_cross(const Line& line) const {
		return sign((to - from).cross(line.from - from)) * sign((to - from).cross(line.to - from)) <= 0 && sign((line.to - line.from).cross(from - line.from)) * sign((line.to - line.from).cross(to - line.from)) <= 0;
	}
}; 
struct Block {
	int min_x, min_y, max_x, max_y, height;
	Line left() const { return Line{ Coordinate{min_x, min_y}, Coordinate{min_x, max_y} }; }
	Line right() const { return Line{ Coordinate{max_x, min_y}, Coordinate{max_x, max_y} }; }
	Line top() const { return Line{ Coordinate{min_x, max_y}, Coordinate{max_x, max_y} }; }
	Line bottom() const { return Line{ Coordinate{min_x, min_y}, Coordinate{max_x, min_y} }; }
	bool is_on_line(const Line& line) const { return is_contains(line.from) || is_contains(line.to) || left().is_cross(line) || right().is_cross(line) || top().is_cross(line) || bottom().is_cross(line); }
	bool is_contains(const Coordinate& coordinate) const {
		return (left().to - left().from).cross(coordinate - left().from) <= 0 &&
			(top().to - top().from).cross(coordinate - top().from) <= 0 &&
			(right().from - right().to).cross(coordinate - right().to) <= 0 &&
			(bottom().from - bottom().to).cross(coordinate - bottom().to) <= 0;
	}
};
double max_radius(const Line line, const Block block) {
	if (block.is_on_line(line)) return 0.0;
	auto min_distance = std::min({ line.min_distance(block.left()), line.min_distance(block.right()), line.min_distance(block.top()), line.min_distance(block.bottom()) });
	if (min_distance <= block.height) return min_distance;
	else return (min_distance * min_distance + block.height * block.height) / block.height / 2;
}

int main() {
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		Line line; std::cin >> line.from.x >> line.from.y >> line.to.x >> line.to.y;
		double radius = DBL_MAX;
		for (auto i = 0; i < n; ++i) {
			Block block; std::cin >> block.min_x >> block.min_y >> block.max_x >> block.max_y >> block.height;
			radius = std::min(max_radius(line, block), radius);
		}
		std::cout << std::setprecision(10) << std::fixed << radius << std::endl;
	}
}

double Line::min_distance(const Line& that) const
{
	return std::min({ min_distance(that.from), min_distance(that.to), that.min_distance(from), that.min_distance(to) });
}

double Line::min_distance(const Coordinate& that) const
{
	auto vec = to - from;
	if ((that - from).dot(vec) >= 0 && (that - to).dot(vec) <= 0) {
		return std::abs(vec.y * that.x - vec.x * that.y + to.x * from.y - to.y * from.x) / std::sqrt(vec.x * vec.x + vec.y * vec.y);
	}
	else {
		return std::min({ to.distance_from(that), from.distance_from(that) });
	}
}



Measured memory_bytes: 3244