ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1754. Explosion in a Pyramid

Time limit: 0.5 second
Memory limit: 64 MB
Lich Sandro is standing on the floor of a triangular pyramid at the point (x0, y0, 0). The vertices of the pyramid have coordinates (x1, y1, 0), (x2, y2, 0), (x3, y3, 0), (x4, y4, H). He wants to fly to the point (x0, y0, h) and create a spherical force field centered at that point. A rise to the height z takes z units of mana. Creating a field of radius r takes r units of mana. If the force field has at least one common point with the walls or floor, then the pyramid collapses. Initially Sandro has m units of mana. Is this amount sufficient to break the pyramid with a force field?

Input

The first line contains the integers m, h, H (1 ≤ m, h, H ≤ 1000). In the following five lines, you are given the integers xi, yi, where 0 ≤ i ≤ 4 (−1000 ≤ xi, yi ≤ 1000). The point (x0, y0, h) lies strictly inside the pyramid.

Output

Output “YES” if Sandro can break the pyramid with a force field, otherwise output “NO”.

Samples

inputoutput
13 6 30
6 6
0 0
0 30
30 0
0 0
YES
11 6 30
6 6
0 0
0 30
30 0
0 0
NO
Problem Author: Alexander Ipatov
Problem Source: XI USU Open Personal Contest (March 13, 2010)