Vaqt limiti: 1 sekund
Xotira limiti: 64 MB
A goat is tied to a peg (in a
point C) in a garden with a strong rope of the length L (i.e.
a goat may eat a grass that is not farther than L meters from the
peg). There is a bed of pineapples that he loves very much. The bed is a line
segment with the ends A and B.
Humph… We wonder, how much the goat is to stretch the
rope in order to reach at least one pine apple? And all the
pineapples?
Input
There are points’ A, B and C
coordinates and a length of the rope L in the input. All the
numbers are integer, L ≥ 0, all
the coordinates don’t exceed 10000 by the absolute value. The numbers are
separated with spaces or line feeds.
Output
The first line should contain
the minimal length that the goat is to elongate the rope in order to reach the
pineapples bed. The second line should contain the minimal length that the goat
is to elongate the rope in order to eat all the pineapples from the bed. All
the numbers are to be outputted within four digits after a decimal point.
Sample
¹ |
Input |
Output |
1 |
8 -6 8 6 0 0 7 |
1.0000 3.0000 |
Text from: acm.timus.ru