Charlie the Cockchafer

No attempts yetTime limit1sMemory limit128 MB

Problem

Charlie knows how to fly. Even so, moving from one point to another is a tedious chore for him, because Charlie is a cockchafer — and it is well known that every cockchafer (do not confuse them with cockroaches) is clumsy and slow. They need time not only to fly along a straight line, but also, and even more so, to make turns. Knowing these limitations, can you help Charlie find the fastest route?

Input

The input consists of several instances and continues until the end of the file.

The first line of each instance contains three integers $N$, $S$, and $T$ ($1 \le N \le 1000$, $1 \le S, T \le 1000$), where $N$ is the number of straight flight trajectories (called cockridors), $S$ is Charlie's flying speed in meters per second, and $T$ is his turning speed in degrees per second.

The second line contains six integers $X_f, Y_f, Z_f, X_t, Y_t, Z_t$ ($0 \le X_f, Y_f, Z_f, X_t, Y_t, Z_t \le 10000$), giving the starting point $(X_f, Y_f, Z_f)$ and the destination $(X_t, Y_t, Z_t)$.

Each of the next $N$ lines contains six integers $X_1, Y_1, Z_1, X_2, Y_2, Z_2$ ($0 \le X_1, Y_1, Z_1, X_2, Y_2, Z_2 \le 10000$), describing a cockridor: a line segment joining $(X_1, Y_1, Z_1)$ and $(X_2, Y_2, Z_2)$. No interior point of any segment is an endpoint of another segment, and both the start and the destination are endpoints of at least one segment. All coordinates are given in meters.

Output

For each instance, print on its own line the minimum time $R$ that Charlie needs to travel from the start to the destination, rounded to exactly 4 digits after the decimal point.

Charlie may fly only along whole segments, and every segment may be used in either direction. The time of a route is $R = L/S + D/T$ seconds, where $L$ is the total length of the traversed segments (in meters) and $D$ is the total of the turning angles between consecutive segments (in degrees). You may freely choose Charlie's initial and final facing direction, so there is no turning cost before the first segment or after the last one. A path from the start to the destination is guaranteed to exist.