A mega-scale project to convert laser light into usable energy for general purposes has begun in the almost infinite experiment area with laser-amplifying glass panes.
The experiment was conducted by placing a laser emitter in one room. After that, the $$$N$$$ laser receivers were placed in room coordinates $$$(x_i,y_i)$$$; each room has a glass pane on the vertical and horizontal side which is shared between adjacent rooms.
The room coordinate in the experiment area with a glass pane on each side Furthermore, the administrator of the project has provided 1 L-shaped reflector to change the trajectory of the laser from horizontal to vertical or vice versa. You want to run $$$Q$$$ simulation tests to provide the information on the minimum possible laser intensity given the starting point for the laser at coordinates $$$(s_i,t_i)$$$; your task is to come up with the resulting laser intensity.
The first line contains four integers $$$N,Q,A,B$$$ ($$$0 \le A,B \le 10^9,1 \le N,Q \le 100\,000$$$) — number of laser receivers, simulations, amplification power of vertical and horizontal glass panes.
Next, $$$N$$$ lines contain $$$x_i,y_i,c_i$$$ ($$$0 \le x_i,y_i \le 10^9,0 \le c_i \le 10^{18}$$$) — laser receiver coordinates in the Cartesian plane and laser amplification power.
Next, $$$Q$$$ lines contain $$$s_i,t_i$$$ ($$$0 \le s_i,t_i \le 10^9$$$) — laser emitter starting coordinates in the Cartesian plane in each simulation.
Print $$$Q$$$ lines, each line contains a single integer — the minimum possible laser intensity for the simulation.
5 3 1 21 1 04 2 02 3 35 4 04 5 23 34 11 6
3 2 7
The arrangement for minimum possible laser intensity for first and third simulation For the first simulation, the L-shaped reflector can be placed on coordinate (3,4); by activating the second receiver, the minimum final laser intensity is $$$1+2+0 = 3$$$.
For the second simulation, the L-shaped reflector is not used; by activating the second receiver, the minimum final laser intensity is $$$2+0 = 2$$$.
For the third simulation, the L-shaped reflector can be placed on coordinate (1,5); by activating the fifth receiver, the minimum final laser intensity is $$$2+1+1+1+2 = 7$$$.
| Name |
|---|


