There's treasure everywhere!

No attempts yetTime limit1sMemory limit128 MB

Problem

Finding buried treasure is simple: all you need is a map! The pirates of the Caribbean were famous for their enormous buried treasures and their elaborate maps. A map usually reads like this: “Start at the lone palm tree. Take three steps toward the forest, then seventeen steps toward the small spring, …, and finally six steps toward the giant rock. Dig right here, and you will find my treasure!” Most of these directions simply mean taking the stated number of steps in one of the eight principal compass directions: north (N), northeast (NE), east (E), southeast (SE), south (S), southwest (SW), west (W), and northwest (NW).

Following such a map may lead to a scenic tour, but if you are in a hurry there is a much faster way: march straight from the starting point to the treasure. For example, instead of walking three steps north, one step east, one step north, three steps east, two steps south, and one step west, going directly to the destination covers a distance of only about $3.606$ steps.

Write a program that, given a traditional map, computes the location of the buried treasure and the straight-line distance to it.

Input

The input consists of several lines, each a single string of at most $200$ characters. The last line is END, which marks the end of the input and does not describe a map.

Every other line describes one treasure map in the following format: a comma-separated list of pairs, where each pair is a length (a positive integer less than $1000$) immediately followed by a direction. The directions are N (north), NE (northeast), E (east), SE (southeast), S (south), SW (southwest), W (west), and NW (northwest). For example, 3W means three steps west and 17NE means seventeen steps northeast. A full stop (.) terminates each description, which contains no spaces.

Output

For each map, first print a line Map #k, where k is the map's number starting from $1$. Then print the treasure's absolute coordinates on the next line in the format:

The treasure is located at (x,y).

The coordinate system has the x-axis pointing east and the y-axis pointing north, and every path starts at the origin $(0,0)$. A diagonal step (NE, NW, SE, SW) has the same length as a cardinal step, so a step of length $L$ in a diagonal direction changes each of the two coordinates by $L/\sqrt{2}$.

On the following line, print the straight-line distance from $(0,0)$ to the treasure in the format:

The distance to the treasure is d.

Print $x$, $y$, and $d$ with exactly three digits after the decimal point, rounding half to even. Separate the reports of consecutive maps with a blank line.