Zakhar is participating in a geometry contest named after Vadim Barinov, where he encountered a rather interesting problem. He was given a convex polygon with N vertices in Cartesian coordinates. The problem involved cutting the polygon along its diagonals. Zakhar needed to make several cuts, but he was a bit unsure of his abilities, so in addition to the cuts, he also took some measurements. Formally, Zakhar performed Q actions of two types:
-
Measurement: Zakhar chooses two vertices of the polygon, draws a diagonal between them, thus dividing the polygon into two parts. Then he measures the areas of these two polygons and writes down the larger of the two areas on a piece of paper.
-
Cut: Zakhar chooses two vertices of the polygon, draws a diagonal between them, and the polygon is also divided into two parts. After that, he cuts off and discards the part with the smaller area. In case of equality, he discards the part that has a vertex with an ordinal number smaller or larger than the ordinal numbers of both initially chosen vertices. He writes down the area of the cut polygon on a piece of paper.
Zakhar performed all these actions at the very beginning of the contest, and now the contest is coming to an end, but the piece of paper with his notes has somehow gone missing. Fortunately, Zakhar remembers all his actions by type and the numbers of the vertices he chose. Help him restore the contents of the piece of paper.
Input
The first line contains two integers N and Q — the number of vertices of the convex polygon and the number of Zakhar’s actions (4 ≤ N ≤ 105, 1 ≤ Q ≤ 105).
The next N lines describe the coordinates of the polygon’s vertices in counter-clockwise order with two integers xi and yi. It is guaranteed that the polygon is convex. All coordinates do not exceed 109 in absolute value.
The following Q lines describe Zakhar’s actions in the format “ti li ri”, where ti — the type of action: ‘m’ for measurement, ‘c’ for cut; 1 ≤ li, ri ≤ N. It is guaranteed that the segment from vertex li to vertex ri is always a diagonal, meaning both of these vertices are in the current polygon and do not form one of the sides of this polygon.
Output
Output Q lines with the area recorded on the piece of paper after each of Zakhar’s actions.
The answer will be accepted if the absolute or relative error of each number does not exceed 10−9.
Sample
| input | output |
|---|
5 4
2 0
3 1
2 2
0 2
0 0
m 5 3
m 2 4
c 1 3
m 4 1
| 3.0
4.0
1.0
2.0
|
Problem Author: Vadim Barinov