Floor planning is an important part in chip design. Better floor planning result in smaller area, and smaller area result in better chip yield.
Floor planning is usually represent as a tree which contains 3 kinds of nodes: leaf node, H node, and V node.
H node represent as a horizen cut. Left sub-tree is the bottom half, and right sub-tree is the top half.
V node represent as a vertical cut. Left sub-tree is the left half, and right sub-tree is the right half.
H node represent as a basic block which contains the block's height and block's width.
Please write a program to calculate the area of each floor plan and find out the minimum and the maximum area.
The first integer is the number of blocks.
For each blocks, you will get it's serial number, then it's height, and it's width.
Later on you will get a number of how many floor plan you have to calculate.
For each floor plan, you will get a post-order sequence of the tree.
The sequence will only contain 'H', 'V', and numbers.
Print the number of blocks first.
For each blocks, you should print it's serial number, then it's height, and it's width.
Later on print the number of floor plans.
For each floor plan, you should print the post-order sequence of the tree and it's height, it's width, also it's area.
Finally, you should print the minimum/maximum area and which tree it belong to.