Flatland is a plane with a Cartesian coordinate system Oxy. Its citizens are points that move at speed 1, so the minimum time to travel from a point V to a point W equals the length of the segment VW. Flatland schools teach this as the "shortest path theorem".
The theorem stopped holding once parabolic teleports were invented. A parabolic teleport is a contiguous arc of a parabola along which you can move at infinite speed: you can travel between any two points on the same teleport in zero time.
The points (x,y) of a teleport satisfy y=Ax2+Bx+C for XL≤x≤XR, where A, B, C, XL, XR are the teleport's parameters.
N teleports have already been built. Given two points V and W, compute the minimum time needed to travel from V to W. You may walk in a straight line between any two points at speed 1, and you may step onto or off of any teleport at any of its points at no cost.
The first line contains an integer N (0≤N≤100), the number of teleports. The second line contains two integers XV and YV (−100≤XV≤100, −106≤YV≤106), the coordinates of the source point V. The third line contains two integers XW and YW (−100≤XW≤100, −106≤YW≤106), the coordinates of the destination point W.
Each of the next N lines contains five integers Ai, Bi, Ci, XLi, XRi describing the i-th teleport (−100≤Ai,Bi,Ci≤100, Ai=0, −100≤XLi<XRi≤100).
Print a single number: the minimum time to travel from V to W, rounded to exactly 4 digits after the decimal point.