Seventh Color

Time Limit : 8 sec, Memory Limit : 65536 KB
Japanese version is here

Now judge is temporally not available for this problem. We are earnestly making necessary data. Sorry for the inconvenience.

Problem K: Seventh Color

There is a pretty princess in a little country. The princess is sickly but has a strong will. She is very friendly with a boy who is her childhood friend. He is training everyday to become a knight. The princess with curiosity always invites the boy to an adventure outside the castle.

The boy, a donzel, can shoot magic using magical brush and ink with seven different colors. For example, if he draw a line, the paint become a sheeld and defend them, and if he draw a wedge, the paint become an arrow-head to attack enemy.

One day, when the princess were reading books related to magic, she found a book on how to use a very strong magic. The magic can be invoked by drawing several circles of different size and position. The princess asked the boy to try the magic.

"Chudo-n!" The boy could invoke the magic and the princess was delighted with his success. This is all I need to attack enemies. However, the boy noticed that this magic has a serious problem. This magic spends much more ink to draw many circles. He wants to save his ink as much as possible because he can not hold much ink at the same time.

Through a trial and error process, they finally found out a fact. He can obtain the same effect without drawing all the circle perfectly. This means, he need to draw only some parts, where the enemy can reach without getting over circumference of any other circles. He do not need to draw for other parts.

Please see the following figures, for example. The black solid line represent circles he needed to draw at first and a red point represents the position of the enemy. The red solid line represent the parts which the boy should draw.

example1

example2

example3

He use one unit of ink to draw one unit of line. Please write a program which computes the amount of ink they need.

Input

Input consists of several datasets.

The first line of each dataset consists of an integer n representing the number of circles.

Next n lines represent information of the circles. Each circle consists of three real numbers x, y and r representing the coordinate of the center (x, y) and radius respectively.

Next line consists of the coordinate of the enemy x and y.

Input ends when n = 0.

Output

For each dataset, output the amount of ink. You can print any number of digits and answer with an error less than 1.0e-5 will be accepted.

Constraints

  • 1 ≤ n ≤ 100
  • No two circles overlap completely.
  • No two circles contact with at one point.
  • No three circles intersect at one point.
  • The enemy is not on the circumference of any circles.

Sample Input

2
50 50 50
100 100 50
75 75
2
50 50 50
100 100 50
50 50
0

Output for the Sample Input

157.07963268
314.15926486