Joy of Flight

No attempts yetTime limit2sMemory limit256 MB

Problem

Jacob flies a radio-controlled aircraft. Today is windy, so he has to plan the flight in advance. He has a forecast that gives the wind for every second of the flight.

The airspeed of the plane during one second can be any vector of length at most vmaxv_{max}. If the airspeed during a second is (vx,vy)(v_x, v_y) and the wind during that same second is (wx,wy)(w_x, w_y), the plane moves by (vx+wx,vy+wy)(v_x + w_x, v_y + w_y) in that second.

Jacob has fuel for exactly kk seconds. He wants to know whether the plane can get from the start SS to the finish FF within that time, and if it can, where the plane is at the end of each second.

Input

The first line contains four integers SxS_x, SyS_y, FxF_x, FyF_y, the coordinates of the start and the finish (10000Sx,Sy,Fx,Fy10000-10000 \le S_x, S_y, F_x, F_y \le 10000).

The second line contains three integers nn, kk, vmaxv_{max}: the number of wind records, the length of the flight in seconds, and the maximum airspeed (1n,k,vmax100001 \le n, k, v_{max} \le 10000).

Each of the next nn lines contains three integers tit_i, wxiw_{x_i}, wyiw_{y_i}. From time tit_i on, the wind blows by the vector (wxi,wyi)(w_{x_i}, w_{y_i}) each second (0=t1<t2<<tn<k0 = t_1 < t_2 < \dots < t_n < k, and wxi2+wyi2vmax\sqrt{w_{x_i}^2 + w_{y_i}^2} \le v_{max}). The wind during the second that runs from time jj to time j+1j + 1 is the vector of the last record whose time tit_i is at most jj.

Output

Write wjw_j for the wind during the jj-th second, W=w1+w2++wkW = w_1 + w_2 + \dots + w_k for the total drift, and D=FSWD = F - S - W for the displacement the plane has to cover on its own.

If the length of DD is greater than kvmaxk \cdot v_{max}, print No on a single line.

Otherwise print Yes on the first line, then the kk lines of the flight plan. Print the plan that holds the airspeed constant at D/kD / k for the whole flight, so the position at the end of the ii-th second is

Pi=S+j=1iwj+ikDP_i = S + \sum_{j=1}^{i} w_j + \frac{i}{k} D

The ii-th of those kk lines contains the two coordinates of PiP_i, separated by a space, each written with exactly 6 digits after the decimal point. A coordinate that lands exactly halfway between two multiples of 10610^{-6} is rounded up.

This plan uses airspeed of length D/k|D| / k in every second, so it respects the speed limit whenever any plan does.