Tariffs
Nowadays practically every mobile operator has a wide range of tariffs that allows each person to choose the most suitable one for himself. Unfortunately to carry out it manually is a very difficult choice.
One mobile operator characterize each tariff with three numbers: the subscription fee c[i]
(in rubles), the minimal tariffed time unit t[i]
(in seconds), the cost of minimum tariffed unit of time p[i]
(in kopecks, one ruble contains 100 kopecks). The total cost of calls for the month consists of the subscription fee and the cost of each outgoing call. The cost of the call when using the i-th tariff is calculated as follows: let the call time equals to T seconds. If T < t[i]
, then the cost of the call equals to zero. Otherwise, the cost of the call equals to the product of k by p[i]
, where k the minimum integer such that k · t[i]
≥ T.
The description of tariffs and statistics of outgoing phone calls in a month are given. The number of calls is m, their durations are d[1]
, ..., d[m]
in seconds. Find the tariff when the total cost of all these calls would be minimal.
Input
First line contains two integers n and m - respectively the number of tariffs and number of outgoing phone calls (1 ≤ n, m ≤ 100). Each of the next n lines describes one tariff and contains three integers: c[i]
(0 ≤ c[i]
≤ 100), t[i]
(1 ≤ t[i]
≤ 3600), p[i]
(0 ≤ p[i]
≤ 1000).
The last line contains m integers d[1]
, ..., d[m]
(1 ≤ d[i]
≤ 3600 for all i from 1 to m).
Output
Print the tariff number, using which the total cost of outgoing calls during the reporting month is minimal. The tariffs are numbered with integers from 1 to n in the same order like they are given at input. If there are many such tariffs, print any of them.