GEOM - Geometry and a Square

no tags 

Is there anyone who doesn't love geometry?! Just imagine: on the plane you are given a square ABCD, with vertices given in the clockwise direction. Also given is a point P which is different from all of A, B, C or D. Have you imagined it? Interested? Ok, let's continue!

Through vertex A a line a is drawn that is perpendicular to line BP, through vertex B a line b is drawn that is perpendicular to line CP, through vertex C a line c is drawn that is perpendicular to line DP, through vertex D a line d is drawn that is perpendicular to line AP. Do the lines a, b, c and d cross each other in one point? Ok, it depends on what the square is and what point P is given. Write the program that discovers if these lines cross in one point, and if so, finds the coordinates of this point.

Input

In the first line you are given the integer coordinates of the point in which diagonals of the square intersect. In the second line you are given one integer - the length of the side of the square. In the third line you are given the integer coordinates of point P. The integers do not exceed 100, in terms of absolute value.

Output

For each test case you must output YES if the sought point exsists, and NO otherwise. If you answer YES then in the second line you must output the coordinates of the intersection point. Coordinates must be rounded to one digit after the point.

Example

Input:
10 10
20
5 12

Output:
YES
8.0 5.0

Author: Filimonenkov D.O.


hide comments
Infinity: 2014-08-20 07:16:02

just 1 test case?

Last edit: 2014-09-12 08:17:39
(Tjandra Satria Gunawan)(曾毅昆): 2012-05-05 04:40:35

really tricky... ;) Nice Problem....


Added by:Roman Sol
Date:2006-05-05
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST WHITESPACE
Resource:ZCon 2007