G: Quest of Merchant
To achieve good results in ICPC, training is essential. Rabbit wants to win in ICPC, so he decided to train today as well.
Today's training is to run around the town and trade, to gain the power of business.
For future training, Rabbit wants to earn as much money as possible.
In this world, the roads are lined up at equal intervals in the north, south, east, and west directions, making a grid pattern. The only market is located at (0, 0), and the coordinates of x and y are determined for the town (the points corresponding to the intersections correspond to the integer values of the coordinates). Rabbit can only move along the road and takes 1 minute to move between adjacent intersections. There are some towns at the intersections. In trading, he buys goods in the town and sells them at the market to gain the profit of the price difference.
Rabbit has enough initial capital, so he never runs out of money and cannot buy goods. However, each product has a weight, and Rabbit can only carry goods up to a total weight of W at a time. Therefore, he visits town to purchase goods and returns to the market. Depending on the situation, he may purchase goods in multiple towns before returning to the market.
Buying goods in town and selling them in the market can be done in an instant. Also, it is possible to purchase an infinite number of goods, and there is no possibility that the goods in the town will be sold out.
Rabbit has compiled data on the names, weights per unit, and selling prices of each product he wishes to trade this time, as well as the names, x and y coordinates, and selling prices of the products sold in each town. Rabbit is now at the market (0, 0). Using a program, he wants to find out how much he can earn in T minutes.
Input
N M W T
S1 V1 P1
 ...
SM VM PM
L1 X1 Y1
R1,1 Q1,1
  ...
R1,L1 Q1,L1
 ...
LN XN YN</sub