cho.sh
Notes
Loading...

Shadow

Time limit

2s

Memory limit

128 MB

Problem

A streetlight behaves as a point light source. Near it, an axis-aligned rectangular box-shaped tree is placed. In the coordinate system, the z-axis is height above the ground, and the ground is the plane z = 0.

The tree is given by two opposite vertices of the rectangular box. It may be floating above the ground. Find the area of the tree's shadow on the ground.

Input

The first line contains six integers x1 y1 z1 x2 y2 z2: the coordinates of one vertex of the tree, followed by the coordinates of the opposite vertex. The second line contains three integers x y z, the coordinates of the point light source.

All coordinates are positive integers at most 10 and are given in x, y, z order. The point light source is not on the boundary of the rectangular box.

Output

Print the area of the shadow on the first line. If the area is infinite, print -1. If the shadow is an infinite line and therefore has area 0, print 0.

An absolute or relative error up to 10^-6 is accepted.

Hint

Some side lengths of the rectangular box may be 0, so the actual shape can degenerate into a point, a line segment, or a rectangle. If the tree reaches the height of the light source, the shadow can extend infinitely; it has area 0 only when all such directions lie on a single line.