The Empire is not safe. Because of the lingering economic crisis,
people's discontent is growing in central sectors. On the outskirts of
the Galaxy, the Rebels' activity has sharply increased. The Imperial Fleet has to
repel attacks on strategically important stellar systems almost every day. The
hostilities have led to the drastic increase in fuel consumption. The situation
is aggravated by the fact that local facilities for helium-3 production are
scarce and fuel has to be brought from the center of the Galaxy. The Rebels
are well-informed about that and regularly carry out raids upon main logistics hubs, which leads to the permanent fuel shortage.
Darth Vader charged Commander of the Fleet with the task of improving this
situation as soon as possible. A group of officers proposed a plan based on the
constant change of supply routes with a simultaneous increase in the number of
patrols. But Head of Advanced Defense Technology Department came forth with a
more radical proposal. He suggested decreasing the dependence of the Fleet on
the fuel supply by using alternative energy sources. In his opinion, the most
promising technology was the use of photovoltaic cells. He proposed to cover all
spaceships with solar panels which would absorb the energy of stars.
The officers were shocked by this plan, because any competent specialist
understands that even if every square meter of the surface of a spaceship were
covered with solar batteries their power would be insufficient for the
supply of the hyperdrive. The worst of it was that Commander of the Fleet liked
the idea. In the course of the ensuing bureaucratic struggle it turned out that
the owner of the largest supplier of solar panels was the son of Head of Advanced
Defense Technology Department. In order to discredit the proposal still
further, the officers asked you to calculate the power provided by solar
panels for a typical spaceship in that sector of the Galaxy.
As you were working on this task, an unknown man dressed in all black came into your
cabin. He was quite friendly and offered his assistance. He promised you a rapid
career advancement if you inflated the result twofold. And if you refused, he
wouldn't be able to guarantee your family's safety. After some thought, you
agreed.
Input
A typical spaceship is a tetrahedron. In the first four lines you are given the
coordinates of its vertices. These are integers with absolute values not
exceeding 100; the unit of measure is meter. In the following line you are
given the number n of stars (1 ≤ n ≤ 10).
Each of the following n lines contains three integers, which are the
coordinates of the vector directed to the star. The length of this vector is
the light intensity of the star in watts per square meter. This is a positive
number not exceeding 2500 W/m2, because typical spaceships don't
fly near stars. It is guaranteed that the directions to all stars are
different.
Output
Find the total power of the solar panels of the spaceship taking into
account the man in black's wish. Output this power in watts accurate to 10−5.
The power of a solar panel with an area of 1 m2 illuminated
by light of intensity 1 W/m2 is the cosine of the incidence
angle of the light beams.
Sample
input | output |
---|
0 -1 0
0 1 0
0 0 2
1 0 0
2
0 0 -1358
21 0 0
| 2800.00000
|
Problem Author: Pavel Atnashev
Problem Source: USU Open Personal Contest 2009 (February 28, 2009)