Little Peter Ivanov likes to play knights. Or musketeers. Or samurai. It
depends on his mood. For parents, it is still always looks like “he again
found a stick and peels the trees.” They cannot understand that it is a
sword. Or epee. Or katana.
Today Peter has found a shield. Actually, it is a board from the fence;
fortunately, the nails from it have already been pulled. Peter knows that
the family coat of arms should be depicted on the knight’s shield. The
coat of arms of Ivanovs is a rectangle inscribed in a triangle (only
grandfather supports Peter’s game, and he is, after all, a professor of
mathematics). Peter has already drawn the triangle, and then noticed that
there is a hole from a nail inside the triangle. It is not very good, so
Peter wants to draw a rectangle in such a way that the hole will be on its
Because of the rectangle in Peter’s family symbolizes the authority and
power then Peter wants to draw a rectangle of maximum area.
And due to the fact, that Peter is a grandson of
grandfather-mathematician, he is also interested in purely theoretical
question — how many different rectangles, satisfying the conditions,
can be drawn in the triangle.
Help Peter to find the answers to these questions.
The four lines contain the coordinates of four points that are the
vertices of the triangle and the hole, respectively. All coordinates are
integers and do not exceed 104 in absolute value. It is guaranteed
that the hole is strictly inside the triangle. Also it is guaranteed that
the triangle vertices do not lie on one line.
In the first line output the maximum area of a rectangle, which Peter can
draw. The answer will be considered correct if a relative or absolute
error of maximum area does not exceed 10−6.
In the second line output the number of different rectangles that Peter
can draw (these rectangles are not required to have the maximum
The rectangle is called inscribed in a triangle if all its vertices lie on
the sides of the triangle.
Problem Author: Alexey Danilyuk
Problem Source: Ural FU Junior Championship 2016