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$.

Difficulty: interview

Starter code:

Solutions:
t=int(input())
while(t):
 n=int(input())
 l=[]
 for i in range(n):
  l.append(list(map(int,input().split())));
 m=[]
 for i in l:
  m.append((i[1]//(i[0]+1))*i[2])
 res=max(m)
 print(res)
 t=t-1

# cook your dish here
t=int(input())
while(t):
 n=int(input())
 l=[]
 for i in range(n):
  l.append(list(map(int,input().split())));
 m=[]
 for i in l:
  m.append((i[1]//(i[0]+1))*i[2])
 res=max(m)
 print(res)
 t=t-1

import math
t=int(input())
for i in range(t):
 n=int(input())
 m=[0]
 for i in range(n):
  s,p,v=map(int,input().split())
  m.append((p//(s+1))*v)
 print(max(m))

for _ in range(int(input())):
 n = int(input())
 arr =[0]*n
 for i in range(n):
  s,p,v = list(map(int,input().split()))

  arr[i] = (p//(s+1))*v
 print(max(arr)) # cook your dish here


# cook your dish here
for i in range(int(input())):
 n=int(input())
 l=[]
 for j in range(n):
  s,p,v = list(map(int, input().split()))
  l.append((p//(s+1))*v)
 print(max(l))



# cook your dish here
for i in range(int(input())):
 n=int(input())
 l=[]
 for j in range(n):
  s,p,v = list(map(int, input().split()))
  l.append((p//(s+1))*v)
 print(max(l))


try:
 
 t=int(input())
 for _ in range(t):
  n=int(input())
  count=0
  maxi=0
  for i in range(n):
   param=list(map(int,input().split()))
   s,p,v=param[0],param[1],param[2]
   s=s+1
   
   p=int(p/s)
   profit=v*p
  
   if(maxi<profit):
    maxi=profit
    count=i+1
  print(maxi)
except:
 pass

try:
 
 t=int(input())
 for _ in range(t):
  n=int(input())
  count=0
  maxi=0
  for i in range(n):
   param=list(map(int,input().split()))
   s,p,v=param[0],param[1],param[2]
   s=s+1
   
   p=int(p/s)
   profit=v*p
  
   if(maxi<profit):
    maxi=profit
    count=i+1
  print(maxi)
except:
 pass

try:
 
 t=int(input())
 for _ in range(t):
  n=int(input())
  count=0
  maxi=0
  for i in range(n):
   param=list(map(int,input().split()))
   s,p,v=param[0],param[1],param[2]
   s=s+1
   
   p=int(p/s)
   profit=v*p
  
   if(maxi<profit):
    maxi=profit
    count=i+1
  print(maxi)
except:
 pass

# cook your dish here
# cook your dish here
import math
t=int(input())
while(t>0):
 n=int(input())
 maxProfit=-1
 for i in range(n):
  val=str(input()).split(" ")
  profit=math.floor(int(val[1])/(int(val[0])+1))*int(val[2])
  if profit>maxProfit:
   maxProfit=profit
 print(maxProfit)
 t-=1

t=int(input())
for i in range(t):
 N=int(input())
 if N==1:
  print(0)
 else:
  k=0
  for i in range(N):
   s,p,v=list(map(int,input().split()))
   h=(int(p/(s+1)))*v
   if h>k:
    k=h
  print(int(k))
  


t=int(input())
for i in range(t):
 N=int(input())
 if N==1:
  print(0)
 else:
  k=0
  for i in range(N):
   s,p,v=list(map(int,input().split()))
   h=(p//(s+1))*v
   if h>k:
    k=h
  print(int(k))
  


t=int(input())
for i in range(t):
 N=int(input())
 if N==1:
  print(0)
 else:
  k=-1
  for i in range(N):
   s,p,v=list(map(int,input().split()))
   h=(p//(s+1))*v
   if h>k:
    k=h
  print(int(k))
  


# cook your dish here
import math
t=int(input())
while(t>0):
 n=int(input())
 maxProfit=-1
 for i in range(n):
  val=str(input()).split(" ")
  profit=math.floor(int(val[1])/(int(val[0])+1))*int(val[2])
  if profit>maxProfit:
   maxProfit=profit
 print(maxProfit)
 t-=1

import math
T = int(input())
for _ in range(T):
 n = int(input())
 #s = []
 #v = []
 #p = []
 m = -1
 for i in range(n):
  si,pi,vi = map(int,input().split())
  si = si + 1
  #s.append(si)
  #v.append(vi)
  #p.append(pi)
  dailyProfit = vi*(math.floor(pi/si))
  #print(si,vi,pi,dailyProfit,m)
  if dailyProfit>m:
   m = dailyProfit
 print(m)

t=int(input())
for T in range(t):
 n=int(input())
 count=0
 maxi=0
 for i in range(n):
  param=list(map(int,input().split()))
  s,p,v=param[0],param[1],param[2]
  
  #if(isinstance(p/(s+1),int)):
  s=s+1
   
  p=int(p/s)
  profit=v*p
  
  if(maxi<profit):
   maxi=profit
   count=i+1
 print(maxi)


# cook your dish here
import math
t = int(input())
for _ in range(t):
 n = int(input())
 maxi = 0
 for i in range(n):
  s,p,v = map(int, input().split())
  h = math.floor(p/(s+1))
  profit = h*v
  maxi = max(maxi, profit)
 print(maxi)

t = int(input())

for _ in range(t):
 n = int(input())
 
 maxi = 0
 for i in range(n):
  s, p, v = [int(x) for x in input().split()]
  
  temp = p//(s+1)
  temp = temp*v
  if(maxi < temp):
   maxi = temp
 
 print(maxi)

for _ in range(int(input())):
 n = int(input())
 s, p, v = list(map(int, input().split()))
 maxm = p//(s+1) * v
 
 for i in range(n-1):
  s, p, v = list(map(int, input().split()))
  prof = p//(s+1) * v
  
  if prof > maxm:
   maxm = prof
 
 print(maxm)

# cook your dish here
t=int(input())
while(t>0):
 t-=1
 v1=[]
 v1.clear()
 n=int(input())
 a=0
 b=0
 while(n>0):
  n-=1
  s,p,v=map(int,input().split())

  if(p%(s+1)==0):
   ##b=0
   a=p//(s+1)
   a=a*v
   v1.append(a)
  else:
   b=p//(s+1)
   b=b*v
   v1.append(b)
 print(max(v1))

for _ in range(int(input())):
 N = int(input())
 C = []
 for i in range(N):
  S, P, V = map(int, input().split())
  if S < P:
   C.append((P // (S+1)) * V)
 print(max(C) if C else 0)

from sys import stdin
rl = stdin.readline


def read(func=int):
 return map(func, rl().strip().split())


for _ in range(int(rl())):
 n = int(rl())

 profit = []
 for _ in range(n):
  s, p, v = read()
  if s < p:
   profit.append(((p)//(s+1)) * v)

 print(max(profit)) if len(profit) > 1 else print(0)

# cook your dish here
t = int(input())
for k in range(t):
 n = int(input())
 lst = []
 for i in range(n):
  s,p,v = map(int, input().split())
  
  
  lst.append((p//(s+1))*v)
 print(max(lst))

# cook your dish here
t=int(input())

while t>0:
 t-=1
 n=int(input())
 m=0
 
 for i in range(n):
  s,p,v = list(map(int,input().split(" ")))
  z=p//(s+1)
  z*=v
  if z>m:
   m=z
 print(m)


# cook your dish here
from math import gcd
t = int(input())
for _ in range(t):
 n = int(input())
 rev = 0
 for _ in range(n):
  si, pi, vi = map(int, input().split())
  rev = max(pi // (si + 1) * vi, rev)
 print(rev)