Museum

No attempts yetTime limit1sMemory limit256 MB

Problem

Byteman, a well known burglar, wants to rob the National Museum of Byteotia. He is after the royal family jewels, which are on display in the grandest hall of the museum. The hall holds nn exhibits, and mm guards watch them. The curator did not want the guards to get in the way of the visitors, so he ordered them to stand at assigned positions and look in one direction the whole time.

Byteman got hold of the plan of the hall, with the positions of the exhibits and the guards marked on it. A jeweler he knows valued every jewel on display, and he also found out how much it costs to quietly persuade each guard to look away during the break in.

Byteman now picks the guards to bribe so that the total value of the jewels that no unbribed guard sees, minus the cost of the bribes, is as large as possible.

Input

The first line contains two integers nn and mm (1n,m2000001 \le n, m \le 200000), the number of exhibits and the number of guards. Positions are given in a rectangular coordinate system on the plan. The second line contains two integers ww and hh (1w,h1091 \le w, h \le 10^9) describing the field of view of the guards. Every guard looks toward decreasing yy, and the tangent of half of the viewing angle is w/hw/h. Guards and exhibits have negligible size. A guard sees every exhibit inside his field of view, including the boundary of that field, even when other exhibits or guards are in the way. That is, a guard standing at (a,b)(a, b) sees the exhibit at (x,y)(x, y) when by0b - y \ge 0 and xah(by)w|x - a| \cdot h \le (b - y) \cdot w.

The next nn lines describe the exhibits. The ii-th of them contains three integers xix_i, yiy_i, viv_i (109xi,yi109-10^9 \le x_i, y_i \le 10^9, 1vi1091 \le v_i \le 10^9), meaning that exhibit ii is worth viv_i bytecoins and lies at the point (xi,yi)(x_i, y_i). The next mm lines describe the guards in the same format, where viv_i is the amount of bytecoins Byteman has to pay to bribe guard ii. At most one guard or exhibit lies at any point.

Output

Print one line with one integer, the maximum profit in bytecoins that Byteman can reach.

Hint

The picture shows the first example. The viewing angle of each guard is a little over 67 degrees. Byteman should bribe two guards, paying 3 + 6 bytecoins, and take the exhibits worth 2 + 8 + 4 + 1 bytecoins.