Superman

Superman, with his incredible power, can fly faster than rockets! He can even pierce the Great Wall if it is in his path, and this doesn’t affect his speed. But he is facing an unbearable problem in large cities now a days. Some regions of these cities are covered with polluted air. When flying through these regions, he can hardly breathe and his speed reduces significantly. He wants to find out whether he could pass through such regions by finding out the length of his path through these regions. Superman knows that each regions of polluted air have the shape of a sphere. He also knows where the polluted regions are located. But he doesn’t know how to calculate the path length inside a sphere. So, he requests you to do that for him. Input There are multiple datasets. Input is terminated by EOF. Each dataset consists of the followings (All numbers are integers < 21 in absolute value): • City name (consisting of 1 to 8 alphanumeric characters) in the first line. • Starting and ending points’ coordinates (x1, y1, z1, x2, y2, z2) of Superman’s path (separated by space(s)). He always flies in a straight line. • Number (between 1 and 10 inclusive) of polluted regions in the third line. • Center and radius (x, y, z, r) of each region (separated by space(s)), one line per region. No two regions intersect each other. Output For each dataset, print the city name in a line followed by the percentage of his path inside polluted regions. The result should be correct to 2 places after the decimal point. Sample Input Dhaka 10 10 10 30 10 10 2 15 10 10 5 25 10 10 5 Rio 10 10 10 30 10 10 1 20 10 5 10 Sample Output Dhaka 100.00 Rio 86.60