#include <iostream>#include <algorithm>#include <cstdio>#include <cstdlib>#include <cmath>using namespace std;const int MAX = 300;struct Node{double x, y;};struct Line{Node s, e;};Line line;Node p[MAX];double A, B, C, delta;double x, y, r;double x11, y11, dx, dy;Node tmp, cir;double sqr(double x){return x * x;}int circle_cross_line(Node s, Node e, Node O, double r)//判断圆与直线是否有交点{double x0 = O.x, y0=O.y;x11 = s.x, y11 = s.y;double x2 = e.x, y2 = e.y;dx = x2 - x11, dy = y2 - y11;A = dx * dx + dy*dy;B = 2 * dx * (x11 - x0) + 2 * dy * (y11 - y0);C = sqr(x11-x0) + sqr(y11-y0) - sqr(r);delta = sqr(B) - 4 * A * C;return delta > 0;}int cmp(Node a, Node b){if (a.x < b.x)return 1;return 0;}int main(){int n, i, cnt;int flag, flagnum;double leng;while (scanf("%d", &n) && n){flagnum = 0;scanf("%lf%lf%lf%lf", &line.s.x, &line.s.y, &line.e.x, &line.e.y);if (line.s.x!=line.e.x){if (line.s.x < line.e.x){tmp.x = line.s.x;tmp.y = line.e.x;}else{tmp.x = line.e.x;tmp.y = line.s.x;}flag = 0;leng = fabs(line.e.x - line.s.x);}else if (line.s.x==line.e.x && line.s.y!=line.e.y){if (line.s.y < line.e.y){tmp.x = line.s.y;tmp.y = line.e.y;}else{tmp.x = line.e.y;tmp.y = line.s.y;}flag = 1;leng = fabs(line.e.y - line.s.y);}elseflagnum = 1;cnt = 0;for (i=0; i<n; i++){scanf("%lf%lf%lf", &cir.x, &cir.y, &r);if (flagnum)continue;if (circle_cross_line(line.s, line.e, cir, r)){p[cnt].x = (-B-sqrt(delta))/(2.0*A);p[cnt].y = (-B+sqrt(delta))/(2.0*A);if (flag==0){p[cnt].x = p[cnt].x * dx + x11;p[cnt].y = p[cnt].y * dx + x11;}else{p[cnt].x = p[cnt].x * dy + y11;p[cnt].y = p[cnt].y * dy + y11;}if (p[cnt].x>p[cnt].y){double t = p[cnt].x;p[cnt].x = p[cnt].y;p[cnt].y = t;}if (p[cnt].x>tmp.y || p[cnt].y<tmp.x)continue;if (p[cnt].x<tmp.x)p[cnt].x = tmp.x;if (p[cnt].y>tmp.y)p[cnt].y = tmp.y; cnt++;}}if (flagnum || cnt==0)printf("0.00n");else{sort(p, p+cnt, cmp);double sum = 0;tmp = p[0];for (i=1; i<cnt; i++){if (p[i].x < tmp.y){if (p[i].y > tmp.y)tmp.y = p[i].y;}else{sum += tmp.y - tmp.x;tmp = p[i];}}sum += tmp.y - tmp.x;printf("%.2fn", sum/leng*100.0);}}return 0;}