#P3596. Illuminated Planet

Illuminated Planet

Description

A space probe is on a mission to observe a planetary system. It is instructed to shoot images of a planet, which orbits a star, using its optical camera. To ensure image quality, it must take the images only when a positive portion of the planet’s surface illuminated by the star is visible.

Given the positions and radii of the planet and the star, and the position of the space probe, determine whether images can be taken in this setting. You do not have to consider the situation that the planet is occulted by the star.

Input

The input contains a single test case. The first line contains four numbers (x, y, z) and r, the Cartesian coordinates of the planet and its radius. The second line contains four numbers (x, y, z) and r, the Cartesian coordinates of the star and its radius. The third line contains three numbers (x, y, z), the Cartesian coordinates of the space probe. The input is physically consistent.

Output

If images can be taken, print “Yes”; otherwise, print “No”.

0 0 0 6.371e3
1.027e8 4.400e8 7.548e8 6.96e5
3.489e9 -1.036e10 -5.249e9
Yes

Hint

The sample uses the real physical setting of Earth, the Sun and the Voyager 2 space probe. Voyager 2 is located far south to the ecliptic and thus always has the illuminated side of Earth within its sight.

Source

PKU Campus 2008 (POJ Founder Monthly Contest – 2008.05.10)

, frkstyc