An unbounded triangular grid is a plane covered by equilateral triangles:
Two neighboring triangles in the grid form a rhomb. There are 3 types of such rhombs:
A grid polygon is a simple polygon which sides consist entirely of sides of triangles in the grid. We say that a grid polygon is rhombastic if it can be partitioned into internally disjoint rhombs of types A, B and C.
As an example let's consider the following grid hexagon:
This hexagon can be partitioned into 4 rhombs of type A, 4 rhombs of type B and 4 rhombs of type C:
For a given rhombastic grid polygon P compute the numbers of rhombs of types A, B and C in some correct partition.
Write a program that:
- reads a description of a rhombastic grid polygon from the standard input,
- computes the numbers of rhombs of types A, B and C in some correct partition of the polygon,
- writes the results to the standard output.