P20133 [CodeChef] STFOOD
普及-
题目描述

in Chefland, there is a very famous street where $N$ types of street food (numbered $1$ through $N$) are offered. For each valid $i$, there are $S_i$ stores that offer food of the $i$-th type, the price of one piece of food of this type is $V_i$ (the same in each of these stores) and each day, $P_i$ people come to buy it; each of these people wants to buy one piece of food of the $i$-th type.
Chef is planning to open a new store at this street, where he would offer food of one of these $N$ types. Chef assumes that the people who want to buy the type of food he'd offer will split equally among all stores that offer it, and if this is impossible, i.e. the number of these people $p$ is not divisible by the number of these stores $s$, then only $\left\lfloor\frac{p}{s}\right\rfloor$ people will buy food from Chef.
Chef wants to maximise his daily profit. Help Chef choose which type of food to offer and find the maximum daily profit he can make.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- $N$ lines follow. For each $i$ ($1 \le i \le N$), the $i$-th of these lines contains three space-separated integers $S_i$, $P_i$ and $V_i$.

-----Output-----
For each test case, print a single line containing one integer ― the maximum profit.

-----Constraints-----
- $1 \le T \le 100$
- $1 \le N \le 100$
- $1 \le S_i, V_i, P_i \le 10,000$ for each valid $i$

-----Subtasks-----
Subtask #1 (100 points): original constraints

-----Example Input-----
2
3
4 6 8
2 6 6
1 4 3
1
7 7 4

-----Example Output-----
12
0

-----Explanation-----
Example case 1: Chef should offer food of the second type. On each day, two people would buy from him, so his daily profit would be $12$.
Example case 2: Chef has no option other than to offer the only type of food, but he does not expect anyone to buy from him anyway, so his daily profit is $0$.

输入格式

见题面

输出格式

见题面

样例输入
['2', '3', '4 6 8', '2 6 6', '1 4 3', '1', '7 7 4']
样例输出
['12', '0']