Under construction

Still being built. Things may change

Maximum Tent Volume

Time limit2sMemory limit512 MB

Summary
Assign n poles of given heights to a central hole and n-1 fixed holes around it to maximize the total volume of the resulting triangles.
Level

Hard8 of 10

Topics
Geometry, Dynamic programming, Greedy, Sorting
Solved
No attempts yet

Problem

A circus is putting up its tent. The canvas is held up by nn poles of various lengths. The holes for the poles are already dug at fixed spots on the ground, but you decide which pole goes into which hole.

One hole is at the origin and takes the central pole. The other n−1n-1 holes lie around the origin. Take two outer poles that are adjacent in the order of their angle around the origin, together with the central pole: the canvas over those three tops is pulled tight into one flat triangle. Only the space under these triangles counts as volume, and the volume under one triangle is the space trapped between the triangle drawn on the ground and the piece of canvas above it.

Assign the poles to the holes so that the total volume under the tent is as large as possible, and report that volume.

Input

The first line contains an integer nn (3≤n≤303 \le n \le 30), the number of poles.

Each of the next n−1n-1 lines contains two integers xx and yy (−1000≤x,y≤1000-1000 \le x, y \le 1000), one hole position on the ground. These lines are not sorted by angle around the origin.

Each of the next nn lines contains one integer hh (1≤h≤1001 \le h \le 100), the length of one pole.

One pole goes into the hole at the origin, and the remaining n−1n-1 poles go into the listed positions, one pole per hole. The listed positions surround the origin: the polygon whose vertices are those positions, taken in order of angle around the origin, contains the origin strictly inside. No two positions have the same angle at the origin, so no canvas triangle has area 0.

Output

Print the largest total volume under the tent, rounded to exactly two decimal places. The exact answer is always a multiple of 16\frac{1}{6} and never falls exactly halfway between two two-decimal values, so the rounded number is unique.

Examples2

  1. Example 1

    Input
    5
    100 100
    -200 -200
    300 -300
    -400 400
    30
    20
    50
    60
    10
    
    Expected output
    8566666.67
    
  2. Example 2

    Input
    4
    0 3
    -4 -3
    4 -3
    7
    7
    7
    7
    
    Expected output
    168.00