Farmer John realizes that the income he receives from milk production is insufficient to fund the growth of his farm, so to earn some extra money, he launches a cow-rental service, which he calls "USACOW" (pronounced "Use-a-cow").
Farmer John has cows, each capable of producing some amount of milk every day. Each of the stores near Farmer John's farm offers to buy a certain amount of milk at a certain price. Moreover, each of Farmer John's neighboring farmers is interested in renting a cow at a certain price.
Farmer John has to choose whether each cow should be milked or rented out to a nearby farmer. Help him find the maximum amount of money he can make per day.
The first line contains three integers n~(1 \le n \le 10^5), m~(1 \le m \le 10^5), and r~(1 \le r \le 10^5). Each of the next lines contains an integer c_i(1 \le c_i \le 10^6), indicating that Farmer John's -th cow can produce c_i gallons of milk every day. Each of the next lines contains two integers q_i and p_i~(1 \le q_i, p_i \le 10^6), indicating that the -th store is willing to buy up to q_i gallons of milk for p_i cents per gallon. Keep in mind that Farmer John can sell any amount of milk between zero and q_i gallons to a given store. Each of the next lines contains an integer r_i~(1 \le r_i \le 10^6), indicating that one of Farmer John's neighbors wants to rent a cow for r_i cents per day.
Print one integer: the maximum profit Farmer John can make per day by milking or renting out each of his cows. Note that the answer might be too large to fit into a standard 32-bit integer, so you may need to use a larger integer type such as "long long" in C/C++.
Example 1
Farmer John should milk cows and to produce gallons of milk. He should completely fill the order for gallons, earning cents, and sell the remaining three gallons at cents each, for a total of cents of milk profit.
Then he should rent out the other three cows for , , and cents to earn more cents. (He should leave the request for a -cent rental unfilled.) This gives a total of cents of daily profit.