Convex Polygon Area (Shoelace Formula)

VERY HARD · C · 5000ms

For an irregular courtyard shaped like a simple polygon, Priya needs its exact area calculated directly from its corner coordinates. Given N vertices of a simple polygon in order (either clockwise or counter-clockwise), print its area using the Shoelace formula, with 2 decimal places.

Input

Line1: N. Next N lines: x y (vertex coordinates in order).

Output

The polygon area, 2 decimals.

Constraints

3 ≤ N ≤ 1000, -10^4 ≤ coords ≤ 10^4

Sample Input

4
0 0
4 0
4 4
0 4

Sample Output

16.00
main.c
Loading editor…

Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.

Convex Polygon Area (Shoelace Formula) · DIU ContestHub