Conference

No attempts yetTime limit1sMemory limit128 MB

Problem

In Bytetown, preparations for the annual Great Bitonic Conference are underway. By tradition, there will be mm presentations that all take place at exactly the same time. Every presentation is held in identical rooms, and each room holds at most kk people. There are always enough rooms for everyone. If a presentation is attended by nn people, it needs n/k\lceil n/k \rceil rooms.

The organizers want to maximize their profit: ticket revenue minus the cost of renting rooms. Renting one room (capacity kk) costs ss. A ticket to presentation ii costs cic_i. Ticket prices are chosen so that filling a room with k/2\lfloor k/2 \rfloor people already yields non-negative profit (it may also be profitable with fewer people). The organizers may cancel any number of reserved tickets in order to increase their profit.

Given the ticket prices, the room capacity, the room cost, and every reservation, compute the maximum profit that can be obtained by cancelling some of the reserved tickets.

Here x\lceil x \rceil is the smallest integer not smaller than xx, and x\lfloor x \rfloor is the largest integer not greater than xx.

Input

The first line contains four integers mm, ll, kk, and ss (1m1001 \le m \le 100, 2l1,000,0002 \le l \le 1{,}000{,}000, 2k4002 \le k \le 400, 1s1,0001 \le s \le 1{,}000): the number of presentations, the number of reservations, the capacity of one room, and the cost of renting one room.

The second line contains mm integers c1,,cmc_1, \dots, c_m, where cik/2sc_i \cdot \lfloor k/2 \rfloor \ge s and cisc_i \le s: the ticket price of each presentation (numbered 11 through mm).

Each of the next ll lines contains two integers pip_i and rir_i (1pim1 \le p_i \le m, 1ri1,0001 \le r_i \le 1{,}000): a reservation of rir_i tickets for presentation pip_i. Within a single reservation any number of tickets may be cancelled, not only the reservation as a whole.

Output

Print one integer: the maximum profit (ticket revenue minus room-rental cost) the organizers can obtain.

Note

In the first example there are 33 presentations with ticket prices 77, 1010, 88, a room capacity of 1010, and a room cost of 3030. Presentation 11 has 99 reserved tickets, so with one room the profit is 7930=337 \cdot 9 - 30 = 33. Presentation 33 has 1313 reserved tickets; keeping all 1313 would need two rooms, but keeping only 1010 (one full room) is more profitable, so 33 tickets are cancelled for a profit of 81030=508 \cdot 10 - 30 = 50. The total is 33+50=8333 + 50 = 83.