### 1434: Area

[状态] [讨论版] [提交] [命题人:]

There are some circles and squares on the plane. The center of the circles and squares are all on the X-axis. Squares have two types. First type, two of the edges parallel with X-axis, and the other two edges are vertical to the X-axis. Second type, one of the diagonal is on the X-axis, and the other diagonal is vertical to the X-axis. Now, give you the circles and squares, can you tell me the area of all circles and square covered the plane?

The first line of the input is an integer T representing the number of the test cases.(T <= 50)
For each test case, the first line will contain one integer N representing the number of circles and squares. (N <= 10)
The following N lines, each line contain a character ‘A’ or ‘B’ or ‘C’, and two nonnegative integers X, D, descriping a circle or a square. Character ‘A’ means this is a first type square, and the coordinate of the square’s center is (X, 0), and the length of the edge is D. Character ‘B’ means this is a second type square, and X, D has the same meaning. Character ‘C’ means this is a circle, and the coordinate of the circle’s center is (X, 0), and the length of the radius is D. (All the nonnegative integers are no more then 10, see the sample input for more details)

Output one line contain one integer representing the area of all circles and square covered the plane, round to integer.

2
2
C 0 5
A 5 10
2
A 0 10
B 5 10


139
154