Joy of Flight
Jacob likes to play with his radio-controlled aircraft. The weather today is pretty windy and Jacob has to plan flight carefully. He has a weather forecast - the speed and direction of the wind for every second of the planned flight.
The plane may have airspeed up to v[max]
units per second in any direction. The wind blows away plane in the following way: if airspeed speed of the plane is (v[x]
, v[y]
) and the wind speed is (w[x]
, w[y]
), the plane moves by (v[x]
+ w[x]
, v[w]
+ w[y]
) each second.
Jacob has a fuel for exactly k seconds, and he wants to learn, whether the plane is able to fly from start to finish in this time. If it is possible he needs to know the flight plan: the position of the plane after every second of flight.
Input
The first line contains four integers S[x]
, S[y]
, F[x]
, F[y]
(-10000 ≤ S[x]
, S[y]
, F[x]
, F[y]
≤ 10000) - coordinates of start and finish.
The second line contains three integers n, k and v[max]
- the number of wind condition changes, durationof Jacob's flight in seconds and maximum aircraft speed (1 ≤ n, k, v[max]
≤ 10000).
The following n lines contain the wind conditions description. The i-th of these lines contains integers t[i]
, w[xi]
and w[yi]
- starting at time t[i]
the wind will blow by vector (w[xi]
, w[yi]
) each second(0 = t[1]
< ... < t[i]
< t[i+1]
< ... < k, sqrt(w[xi]^2
+ w[yi]^2
) ≤ v[max]
).
Output
The first line must contain "Yes" if Jacob's plane is able to fly from start to finish in k seconds, and "No" otherwise.
If it can to do that, the following k lines must contain the flight plan. The i-th of these lines must contain two floating point numbers x and y - the coordinates of the position (P[i]
) of the plane after i-th second of the flight.
The plan is correct if for every i (1 ≤ i ≤ k) it is possible to fly in one second from P[i-1]
to some point Q[i]
, such that distance between Q[i]
and P[i]
doesn't exceed 10^(-5)
, where P[0]
= S. Moreover the distance between P[k]
and F should not exceed 10^(-5)
as well.