Solar Lamps

No attempts yetTime limit1sMemory limit256 MB

Problem

Byteasar has a large and pretty garden. He wants to enjoy it after dusk too, so he installed nn lamps across the garden.

The lamps are directional: each one lights a fixed angle, and that angle is the same for all of them. Byteasar aligned every lamp to face the same direction. These are solar lamps, so they come with solar panels and no batteries. They still shine at night, because a lamp emits light once enough other lamps shine on it.

Byteasar has also fixed the order in which he supplies the lamps with electricity. Numbering the lamps 11 to nn in that order, lamp ii receives electricity at time ii and emits light from then on. Lamp ii also starts emitting light the moment at least kik_i other lamps shine on it. A lamp switched on this way can switch on further lamps, and no time passes while such a chain runs. A lamp that emits light never goes out.

Find the time at which each lamp starts emitting light.

Input

The first line contains the number of lamps nn (1n2000001 \le n \le 200\,000).

The second line contains four integers X1X_1, Y1Y_1, X2X_2, Y2Y_2 separated by single spaces (109Xi,Yi109-10^9 \le X_i, Y_i \le 10^9, (Xi,Yi)(0,0)(X_i, Y_i) \neq (0, 0)). These four numbers describe the area lit by every lamp. For a lamp at the point (x,y)(x, y), draw the two rays that start at (x,y)(x, y) and pass through the points (x+X1,y+Y1)(x + X_1, y + Y_1) and (x+X2,y+Y2)(x + X_2, y + Y_2). The two rays form two angles, and the smaller one, together with its boundary, is the area this lamp lights. This angle is always smaller than 180180 degrees.

Each of the next nn lines holds the position of one lamp. The ii-th of them contains two integers xix_i and yiy_i (109xi,yi109-10^9 \le x_i, y_i \le 10^9) separated by a single space, meaning that lamp ii sits at the point (xi,yi)(x_i, y_i). No two lamps share a position.

The last line contains nn integers k1,k2,,knk_1, k_2, \dots, k_n (1kin1 \le k_i \le n) separated by single spaces. Lamp ii emits light once at least kik_i other lamps shine on it.

Output

Print one line with nn integers t1,,tnt_1, \dots, t_n separated by single spaces. The number tit_i is the time at which lamp ii starts emitting light.

Hint

In the first example Byteasar powers on lamp 11 at time 11, and lamp 33 emits light at the same moment. Once lamp 22 is powered on at time 22, lamps 11, 22 and 33 all shine on lamp 44, so lamp 44 starts emitting light as well.