Many kinds of mushrooms grow in the forest of Byteland. Recently a famous mushroom picker, Mr. Stanislaw, discovered a delicious new species and named it the Stasiek.
A Stasiek is special because you can easily predict how much its weight grows each day. Unfortunately, every mushroom turns poisonous after a certain number of days and can no longer be eaten. Fortunately, Mr. Stanislaw can tell, just by looking at a mushroom, after how many days it will become inedible.
Today Mr. Stanislaw walked through the forest and wrote down the data of every mushroom he saw. Now he wonders after how many days he should come back in order to collect as much mushroom weight as possible. If several days are equally good, he always picks the earliest one. His wife also forbids him from visiting the forest twice in one day, so he cannot come back after 0 days (that is, today).
Each mushroom i weighs mi today (day 0) and its weight grows by pi every day. The mushroom stays edible for di days counting from today, that is on days 0,1,…,di−1, and becomes poisonous on day di. Therefore, if Mr. Stanislaw comes back on a day t≥1, only the mushrooms with t<di are edible, and such a mushroom then weighs mi+pi⋅t.
On the day he returns, Mr. Stanislaw collects the total weight of every mushroom that is still edible. Find the day t≥1 that maximizes this total weight. If several days give the maximum, the answer is the earliest of them.
The first line contains the number of mushrooms n (1≤n≤106).
Each of the next n lines describes one mushroom with three space-separated integers m, p, d (1≤m,p,d≤105): the current weight, the daily weight gain, and the number of days the mushroom stays edible, respectively.
Print a single integer on one line: the number of days after which Mr. Stanislaw should return so that the collected mushroom weight is as large as possible. If the maximum is reached on several days, print the earliest one.
Suppose there are three mushrooms with (m,p,d)=(1,1,2), (5,5,3), (7,2,4). The total weight of the edible mushrooms on each possible return day is:
The total weight of edible mushrooms is largest, 26, after 2 days, so the answer is 2.