Under construction

Still being built. Things may change

Nightmare Awake

Time limit1sMemory limit1024 MB

Summary
Given a circle, a line, and two points, decide whether rotating the circle can make the segment through the two points parallel to the line.
Level

Medium5 of 10

Topics
Geometry, Math
Solved
No attempts yet

Problem

Many people play at magic rituals on Halloween. Most of them do it as a joke, but today you have come across a real magical artifact: a box with an unusual device on its lid.

You decide to open the box no matter what (although in movies this usually ends badly). The device on the lid can be seen as a plane with the following objects:

  • a circle CC with center (x0,y0)(x_0, y_0) and radius rr;
  • a line LL given by the equation ax+by+c=0ax + by + c = 0;
  • two marked points with coordinates (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2).

The circle can be rotated around its center. The marked points that lie on the circle rotate together with it.

You immediately realize that to open the box, the line LL must be parallel to the line through the two marked points. Can the circle be rotated so that these lines are parallel, or will the box stay shut forever?

Input

The first line contains three integers x0x_0, y0y_0, and rr, separated by spaces: the coordinates of the circle's center and its radius (∣x0∣,∣y0∣⩽104|x_0|, |y_0| \leqslant 10^4; 0⩽r⩽1040 \leqslant r \leqslant 10^4).

The second line contains three integers aa, bb, and cc, separated by spaces: the coefficients of the line LL (∣a∣,∣b∣,∣c∣⩽104|a|, |b|, |c| \leqslant 10^4).

The third line contains the coordinates x1x_1 and y1y_1 of the first marked point (∣x1∣,∣y1∣⩽104|x_1|, |y_1| \leqslant 10^4). The fourth line contains the coordinates x2x_2 and y2y_2 of the second marked point in the same format.

Output

Print a single line containing YES if the box can be opened, and NO otherwise.

Examples3

  1. Example 1

    Input
    0 0 6
    1 1 1
    0 0
    1 1
    
    Expected output
    YES
    
  2. Example 2

    Input
    0 0 6
    1 -1 1
    0 0
    1 1
    
    Expected output
    YES
    
  3. Example 3

    Input
    0 0 6
    1 1 0
    6 0
    10 0
    
    Expected output
    NO