Patty’s Gift

Last Christmas, Patty was very busy embroidering a beau- tiful hand-made painting for Tony. When she finished, she placed a tiny hook behind the frame so that Tony could hang it on the wall. Tony is very bad at decorating his house, but he really likes his gift so he wants it to be placed in the best place of the house. He plans to nail two nails on the wall with a rope tied to them, and he wants to have a preview of where the painting will be placed at the end, before he ruins his wall with the holes of misplaced nails. He has drawn a Cartesian plane on the wall, has chosen two arbitrary points (say (a, b) and (c, d)) where he pretends to nail each nail, and he plans to use a rope of an arbitrary length (say L). Now... he doesn’t know where the tiny hook of his gift will be located. Please help Tony to visualize his new decoration, calculating where that hook will be. Assume that the painting is heavy enough to keep the rope tense, and the knots to tie it to the nails don’t diminishes the length. Tony’s world is very boring, so friction does not exist. Input The input consists of several test cases, each one in a single line. For each line you are to read the coordinates of the nails (a, b) and (c,d) and the length of the rope, L, such that −1000 ≤ a,b,c,d ≤ 1000, and 0 ≤ L ≤ 5000. Each value is separated by a space. Output You have to calculate the coordinates (e,f) of the point where the hook will be placed, after the frame is hung on the rope. Your answer will be considered correct if the difference respect to the exact solution is less than 10−6. Sample Input 2 5 7 4 5.099 2 5 7 4 10 10 20 30 40 31 Sample Output 74 4.788675 0.169873 11.555993 18.15728