#D2177. Area of Polygon
Area of Polygon
Area of Polygon
Write a program that reads the coordinates of the vertices of a convex n-sided polygon (a polygon whose internal angles are less than 180 degrees, that is, a polygon that is not dented) and outputs its area. The vertices are named Vertex 1, Vertex 2, Vertex 3, ... Vertex n according to the order of edge connections.
However, n is 3 or more and 20 or less. You can also use the following formula to find the area S from the lengths a, b, and c of the three sides of the triangle.
input
The input is given in the following format:
x1, y1 x2, y2 :: xn, yn
xi and yi are real numbers that represent the x and y coordinates of vertex i, respectively.
output
Outputs the area S (real number) on one line. The output can contain an error of 0.000001 or less.
Example
Input
0.0,0.0 0.0,1.0 1.0,1.0 2.0,0.0 1.0,-1.0
Output
2.500000
inputFormat
outputFormat
outputs its area. The vertices are named Vertex 1, Vertex 2, Vertex 3, ... Vertex n according to the order of edge connections.
However, n is 3 or more and 20 or less. You can also use the following formula to find the area S from the lengths a, b, and c of the three sides of the triangle.
input
The input is given in the following format:
x1, y1 x2, y2 :: xn, yn
xi and yi are real numbers that represent the x and y coordinates of vertex i, respectively.
output
Outputs the area S (real number) on one line. The output can contain an error of 0.000001 or less.
Example
Input
0.0,0.0 0.0,1.0 1.0,1.0 2.0,0.0 1.0,-1.0
Output
2.500000
样例
0.0,0.0
0.0,1.0
1.0,1.0
2.0,0.0
1.0,-1.0
2.500000