#K39132. Calculate Polygon Area using the Shoelace Theorem

    ID: 26353 Type: Default 1000ms 256MiB

Calculate Polygon Area using the Shoelace Theorem

Calculate Polygon Area using the Shoelace Theorem

Given a simple polygon defined by its vertices in the 2D plane, your task is to compute its area using the Shoelace Theorem.

The area A of a polygon with vertices \((x_1, y_1), (x_2, y_2), \dots, (x_n, y_n)\) is given by the formula:

\( A = \frac{1}{2} \left| \sum_{i=1}^{n} \left(x_i y_{i+1} - y_i x_{i+1}\right) \right| \)

Note that the vertex \((x_{n+1}, y_{n+1})\) is the same as the first vertex \((x_1, y_1)\).

Please read the input from standard input and print the resulting area to standard output. The answer should be printed as a floating-point number.

inputFormat

The first line contains a single integer n representing the number of vertices of the polygon. The next n lines each contain two floating point numbers representing the x and y coordinates of a vertex. The vertices are given in order (either clockwise or counterclockwise).

outputFormat

Print a single floating point number which is the area of the polygon computed using the Shoelace Theorem. The output should have one decimal place.

## sample
4
0 0
4 0
4 4
0 4
16.0