Illuminated Planet

Time Limit: 1000ms
Memory Limit: 131072KB
This problem will be judged on PKU. Original ID: 3596
64-bit integer IO format: %lld      Java class name: Main

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”.

Sample Input

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

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

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .