Taunt Exposure Estimation

No attempts yetTime limit1sMemory limit128 MB

Problem

The brave knights of Camelot take steady French taunting from the castle walls while they press their assault. The intensity of the taunting changes with the distance between a knight and the castle, and with how energetic the defenders happen to be. We want to estimate the total taunting the knights absorbed over a fixed stretch of time.

The equipment is old and cannot read continuously. All that survives is a set of measurements taken at unpredictable moments.

The total is the integral of the taunting intensity over the span the data covers. Noise in the readings is high enough that a trapezoid rule approximation is all the data deserves. For every pair of consecutive measurements, compute (xi+1xi)yi+yi+12(x_{i+1} - x_i) \cdot \frac{y_i + y_{i+1}}{2} and add the pieces together.

Taunt Exposure Estimation

Input

The first line contains nn, the number of data points.

Each of the next nn lines holds one measurement: two floating point numbers separated by a comma, which may be followed by a space. The first number is the xx coordinate (the time of the reading) and the second is the yy coordinate (the taunting intensity). The whole file is plain CSV that a spreadsheet program could open.

The xx coordinates are given in increasing order.

1n10001 \le n \le 1000, every coordinate has absolute value at most 10001000, and no coordinate carries more than six digits after the decimal point.

Output

Print one line with the first xx value, the last xx value, and the computed integral in this shape.

<first x> to <last x>: <integral>

Round the xx values to two digits after the decimal point and the integral to four digits. With a single data point the integral is 00 and the two xx values are equal.

Every test stays well away from a rounding boundary, so double precision arithmetic fixes the digits you have to print.