Nowadays, there are several global navigation satellite systems in the world that allow us to determine the exact position and some other parameters of an object on the Earth. These include GPS (Global Positioning System), GLONASS (Global Navigation Satellite System), Galileo (European satellite navigation system), and the fully operational "Beidou" (北斗導航系統) system.
These systems are based on the main principle: the position is determined by measuring the distances to the object from satellites with known coordinates. The distances are calculated using the time delay between when the signal is sent from a satellite and when it is received by the receiver of a global navigation system. To determine the three-dimensional coordinates of the object, one must know the distances from the object to at least three satellites. Moreover, the satellites must be in direct visibility of the object and be placed around it.
This concept is specified by experts as follows: the object must be strictly inside the tetrahedron whose three vertices coincide with the three given satellites and whose fourth vertex is at the center of the Earth.
Since the satellites are constantly changing their positions due to orbital motion, and the object can be located at any geographical point, the total number of satellites in the system must be large enough so that it is always possible to find three that meet the specified conditions.
The software and hardware of global navigation systems are quite complex. Fortunately, you only need to implement a small part of it.
Assume that sea level is at a distance of km from the center of the Earth. It is guaranteed that the object is strictly inside the tetrahedron with vertices at the center of the Earth and the satellites.
Write a program to calculate the height of the object above sea level, given the coordinates of three satellites and their distances from the object.
Each of the first three lines contains three numbers: the Cartesian coordinates of the first, second, and third satellites, respectively. The center of the Earth is at the point (0, 0, 0).
The fourth line contains three space-separated numbers: the distances from the object to the first, second, and third satellites, respectively.
All coordinates and distances are integers, given in meters, in the range [-10^8, +10^8].
The output should contain one number accurate to meters.
Example 1