Under construction

Still being built. Things may change

Stretchy Rubber Band

Time limit1sMemory limit1024 MB

Summary
Given points with distinct x and y, repeatedly remove the leftmost, rightmost, topmost, or bottommost point and report the convex hull area before each removal.
Level

Medium7 of 10

Topics
Geometry, Linked list, Simulation
Solved
No attempts yet

Problem

Mirko found a wooden board and nn nails in an old attic. He hammered the nails into the board right away. Treat the board as a coordinate plane and each nail as a point on it. No two nails share the same xx coordinate or the same yy coordinate.

To keep himself busy with his new finds, Mirko stole his sister's hair rubber band, stretched it around all the nails, and let it go. The band snapped tight around the outer nails. Mirko then repeats the following steps while more than 2 nails remain on the board:

  1. He writes on paper the area of the shape that the rubber band encloses.
  2. He chooses one of the following nails: the leftmost, the rightmost, the topmost, or the bottommost.
  3. He pulls the chosen nail out of the board, and the rubber band tightens again around the outer nails.

Write a program that computes the numbers Mirko writes on paper, given which nail he chose at each step.

Input

The first line contains a natural number nn (3≤n≤3000003 \le n \le 300000). Each of the next nn lines contains two natural numbers xx and yy, the coordinates of one nail. All coordinates are less than 10910^9, and no two nails share an xx coordinate or a yy coordinate.

The last line is a string of n−2n-2 characters, each being L, R, U, or D. They mean that Mirko chose the leftmost, rightmost, topmost, or bottommost nail, respectively.

Output

Print the n−2n-2 areas that Mirko wrote down, in order. Each area must be printed with exactly one digit after the decimal point.

Hint

Explanation of the second test case:

The figure shows the state before each of the 6 steps.

Examples2

  1. Example 1

    Input
    5
    1 4
    2 2
    4 1
    3 5
    5 3
    LUR
    
    Expected output
    9.0
    6.5
    2.5
    
  2. Example 2

    Input
    8
    1 6
    2 4
    3 1
    4 2
    5 7
    6 5
    7 9
    8 3
    URDLUU
    izlaz
    
    Expected output
    34.0
    24.0
    16.5
    14.0
    9.5
    5.0