题目描述
Problem Description
You have trapped a hornet inside a box on your dining table. Unfortunately, your playing dice is also trapped inside – you cannot retrieve it. Instead, you pass your time calculating the expected number of spots on the dice visible to the hornet.
The hornet, the dice, and the box are located in a standard three-dimensional coordinate system with the x-coordinate growing eastwards, the y-coordinate growing northwards, and the z-coordinate growing upwards. The surface of the table corresponds to the x-y plane.
The dice is a 1×1×1 cube, resting on the table with the center of the bottom side at the origin. Thus, the coordinates of its two opposite corners are (-0.5, -0.5, 0) and (0.5, 0.5, 1). The top side of the dice has 5 spots, the south side 1 spot, the east side 3 spots, the north side 6 spots, the west side 4 spots, and the (invisible and irrelevant) bottom side 2 spots.
The box is a 5×5×5 cube also resting on the table with the dice inside it. The box is specified by giving the coordinates of its bottom side – a 5×5 square.
Assume the hornet is hovering at a uniformly random point in the space inside the box not occupied by the dice. Calculate the expected number of spots visible to the hornet. The dice is opaque, so the hornet sees a spot only if the segment connecting the center of the spot and the hornet's location does not intersect the interior of the dice.
Input Format
Input consists of 4 lines. The k-th line contains two floating-point numbers xk and yk (-5 ≤ xk, yk ≤ 5) – coordinates of the k-th corner of the bottom side of the box in the x-y plane. The coordinates are given in the counterclockwise direction and describe a square with a side length of exactly 5.
The box fully contains the dice. The surfaces of the box and the dice do not intersect or touch except along the bottom sides.
Output Format
Output a single floating-point number – the expected number of visible spots. The solution will be accepted if the absolute or relative difference from the judge's solution is less than $10^{-6}$.
Sample Input and Output
Input Sample #1
-2.5 -1.5
2.5 -1.5
2.5 3.5
-2.5 3.5
Output Sample #1
10.6854838710
Input Sample #2
3 0
0 4
-4 1
-1 -3
Output Sample #2
10.1226478495
Notes/Hints
Central Europe Regional Contest 2015 Problem H
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分