435. UFO Circles

Time limit per test: 0.75 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

Recently, British scientists have discovered a huge field of grain on the Mars. They claim that this field is strictly two-dimensional (flat) and spans a nearly infinite area. There are some strange circles on this field, supposedly left by the UFOs. The UFOs are also very strange. When an UFO lands on a grain, the grain in the landing area is burned to ashes. But when an UFO lands on field which is already burned, the inverse grain grows instantly in that place. When an UFO lands on inverse grain field, it is burned just like normal grain. There were cases of UFO landings on areas with both grain fields and burned fields. In these cases the parts with grain were burned, and inverse grain was grown on the other parts.

You are hired by the scientists to help them with calculations. They require you to calculate total area of burned fields and total area of fields with inverse grain.

The first line of input will contain the number of circles N (1 ≤ N ≤ 100). Each of the following N lines contains three integer numbers x, y and r, where are the coordinates of circle center and r is the circle radius. All numbers do not exceed 1000 by absolute value. All circles are different, and all radii are positive.

Output should contain two numbers delimited by a space — the areas you should calculate. These numbers should be accurate to at least three digits after the decimal point. The first number should be the total area of burned fields, the second one should be the total area of inverse grain.

sample input
sample output
0 0 5
0 3 1
75.39822 3.14159

Online Contester Team © 2002 - 2010. All rights reserved.