Class inheritance graph with virtual methods

C# Hard classes

Task «Class inheritance graph with virtual methods»

Develop a class system to represent a hierarchy of geometric shapes with a virtual method for calculating area. The base class Shape contains a virtual method CalculateArea() that returns 0. The Circle class (radius) overrides the method as π*r^2. The Rectangle class (width, height) — width*height. The Triangle class (base, height) — 0.5*base*height. Input data: a number N — the number of shapes, then N lines describing the shapes: "Circle radius", "Rectangle width height", "Triangle base height". It is necessary to calculate the sum of the areas of all shapes with an accuracy of two decimal places.

Input Format

Integer N (1 ≤ N ≤ 100). Then N lines, each containing the name of a shape and its parameters: for Circle — one integer (radius), for Rectangle — two integers (width and height), for Triangle — two integers (base and height). All parameters are positive integers from 1 to 100.

Output Format

One real number — the sum of the areas of all figures, rounded to two decimal places.

Examples

Example 1

INPUT
1 1 0
OUTPUT
0

Example 2

INPUT
2 Rectangle 10 10 Triangle 5 8
OUTPUT
120.00
main.cs