Chef recently opened a big e-commerce website where her recipes can be bought online. It's Chef's birthday month and so she has decided to organize a big sale in which grand discounts will be provided.
In this sale, suppose a recipe should have a discount of x percent and its original price (before the sale) is p. Statistics says that when people see a discount offered over a product, they are more likely to buy it. Therefore, Chef decides to first increase the price of this recipe by x% (from p) and then offer a discount of x% to people.
Chef has a total of N types of recipes. For each i (1 ≤ i ≤ N), the number of recipes of this type available for sale is quantityi, the unit price (of one recipe of this type, before the x% increase) is pricei and the discount offered on each recipe of this type (the value of x) is discounti.
Please help Chef find the total loss incurred due to this sale, if all the recipes are sold out.

-----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 denoting the number of recipe types.
- N lines follow. The i-th of these lines contains three space-separated integers pricei, quantityi and discounti describing the i-th recipe type.

-----Output-----
For each test case, print a single line containing one real number — the total amount of money lost. Your answer will be considered correct if it has an absolute error less than 10-2.

-----Constraints-----
- 1 ≤ T ≤ 10
- 1 ≤ N ≤ 105
- 1 ≤ pricei, quantityi ≤ 100 for each valid i
- 0 ≤ discounti ≤ 100 for each valid i

-----Subtasks-----
Subtask #1 (30 points): 1 ≤ N ≤ 100
Subtask #2 (70 points): original constraints

-----Example-----
Input:

2
2
100 5 10
100 1 50
3
10 10 0
79 79 79
100 1 100

Output:

30.000000000
3995.0081000

-----Explanation-----
Example case 1: There are two recipes.
There are 5 recipes of the first type, each of them has a price of 100 and there is a 10% discount provided on it. Therefore, Chef first increases the price of each recipe by 10%, from 100 to 110. After that, she decreases the price by 10%, which makes the final price 99. The amount of money lost for each unit is 1, thus losing 5 for recipes of the first type.
There is only one recipe of the second type, with price 100 and a 50% discount. Therefore, Chef increases the price of the recipe by 50% from 100 to 150 and after that, she decreases its price by 50% to make its final price 75. She loses 25 for this recipe.
Overall, the amount of money Chef loses is 30.

Difficulty: EASY
Tags: Mathematics

Implementation

Starter code:

Solutions:
for i in range(int(input())):
	x = []
	loss = 0
	for k in range(int(input())):
		y = [int(i) for i in input().split()]
		x.append(y)
		up = y[0] + y[2] * y[0] / 100
		sp = up - up * y[2] / 100
		loss += y[0] * y[1] - sp * y[1]
	print(loss)


for i in range(int(input())):
	n = int(input())
	total = 0
	for i in range(n):
		inp = list(map(int, input().split()))
		p = inp[0]
		q = inp[1]
		r = inp[2]
		curdiscountaf = p + p * r / 100
		curdiscountafd = p - (curdiscountaf - curdiscountaf * r / 100)
		total += curdiscountafd * q
	print(total)


t = int(input())
for i in range(t):
	n = int(input())
	x = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		x = x + q * (p - p * (100 + d) / 100 * ((100 - d) / 100))
	print(x)


f = int(input())
final = []
for yyh in range(0, f):
	lpt = int(input())
	aq = []
	for n in range(0, lpt):
		gg = str(input())
		ll = gg.split(' ')
		op = []
		for jvc in ll:
			op.append(int(jvc))
		aq.append(op)
	final.append(aq)
for uu in final:
	loss = 0
	for iip in uu:
		yrew = iip[-1]
		hnv = iip[0]
		yrewt = yrew / 100
		hnvy = hnv * yrewt
		trd = hnv + hnvy
		oop = trd * yrewt
		rsum = trd - oop
		nel = hnv - rsum
		loss += nel * iip[1]
	print(loss)


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	for j in range(n):
		(p, q, d) = map(int, input().split())
		tmp = p
		p = p + d / 100 * p
		p = p - d / 100 * p
		s = s + (tmp - p) * q
	print(s)


for _ in range(int(input())):
	n = int(input())
	s = 0
	for _ in range(n):
		(p, q, d) = map(int, input().split())
		pi = p + d / 100 * p
		p_new = pi - d / 100 * pi
		loss = (p - p_new) * q
		s = s + loss
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	res = []
	initialprice = 0
	middleprice = 0
	finalprice = 0
	totalloss = 1
	loss = 0
	for i in range(n):
		(p, q, d) = list(map(float, input().split()))
		initialprice = p
		middleprice = initialprice + initialprice * d / 100
		finalprice = middleprice - middleprice * d / 100
		loss = initialprice - finalprice
		totalloss = float(q * loss)
		res.append(totalloss)
	print(float(sum(res)))


for i in range(int(input())):
	n = int(input())
	s = 0
	for i in range(n):
		(c, u, d) = map(int, input().split())
		c1 = c + c * (d / 100)
		d1 = c1 * (d / 100)
		A = abs(c1 - d1)
		B = c - A
		s += B * u
	print(s)


try:
	tap = int(input())
	for i in range(tap):
		num = int(input())
		loss = 0
		for j in range(num):
			l = list(map(int, input().split()))
			p = l[0]
			r = l[1]
			d = l[2]
			t = p + d / 100 * p
			a = t - t * (d / 100)
			loss += (p - a) * r
		print(loss)
except:
	pass


t = input()
t = int(t)
while t != 0:
	n = input()
	n = int(n)
	f = 0
	while n != 0:
		inp = input().split(' ')
		inp = [int(x) for x in inp]
		np = inp[0] * inp[2] * 0.01 + inp[0]
		f += (inp[0] - (np - np * inp[2] * 0.01)) * inp[1]
		n -= 1
	print(f)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = 0
	for i in range(n):
		(a, b, c) = map(int, input().split())
		sp = a + a * c / 100
		sp -= sp * c / 100
		if sp < a:
			l += (a - sp) * b
	print('{:.9f}'.format(l))


for i in range(int(input())):
	m = int(input())
	a = 0
	for j in range(0, m):
		(p, q, d) = list(map(int, input().split()))
		a += (p - (p + d * p / 100 - (p + d * p / 100) * (d / 100))) * q
	print('{0:.9f}'.format(a))


for k in range(int(input())):
	l = 0
	for j in range(int(input())):
		(p, q, d) = map(int, input().split())
		ap = p + p * d / 100
		p1 = ap - ap * d / 100
		b = p - p1
		e = b * q
		l = l + e
	print(l)


t = int(input())
for _ in range(t):
	a = int(input())
	l = 0
	for _ in range(a):
		(x, y, z) = map(int, input().split())
		add_per = x + x * (z / 100)
		act_prz = add_per * (z / 100)
		loss = add_per - act_prz
		act_lss = (x - loss) * y
		l += act_lss
	print('%0.7f' % l)


n = int(input())
for i in range(n):
	n1 = int(input())
	loss = 0
	for j in range(n1):
		l = list(map(int, input().split()))
		loss += l[1] * l[0] * (l[2] * l[2]) / 10000
	print(loss)


for _ in range(int(input())):
	n = int(input())
	loss = 0
	for i in range(n):
		(p, q, d) = list(map(int, input().split()))
		inc = p + d / 100 * p
		dec = inc - d / 100 * inc
		diff = p - dec
		loss += diff * q
	print('{0}'.format(loss))


for _ in range(int(input())):
	n = int(input())
	l = 0
	for i in range(n):
		(n, a, b) = map(int, input().split())
		y = n + n * b / 100
		z = y - y * b / 100
		l = l + a * (n - z)
	print(l)


for _ in range(int(input())):
	n = int(input())
	loss = 0
	for i in range(n):
		(price, qt, dis) = map(int, input().strip().split())
		up = price + price * dis / 100
		down = up - up * dis / 100
		x = price - down
		loss += qt * x
	print(loss)


for _ in range(int(input())):
	n = int(input())
	fsp = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		fp = d / 100 * p + p
		sp = fp - d / 100 * fp
		fsp += abs(sp - p) * q
	print('%.7f' % fsp)


for i in range(int(input())):
	a = int(input())
	sum1 = 0
	sum2 = 0
	for j in range(a):
		(a, b, c) = map(int, input().split())
		sum1 += a * b
		a += a * c / 100
		a -= a * c / 100
		sum2 += a * b
	print(sum1 - sum2)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	for _ in range(n):
		(p, q, d) = map(int, input().split())
		new = p + d * p / 100
		new = new - d * new / 100
		ans += q * (p - new)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	c = 0
	for i in range(n):
		(p, q, x) = map(int, input().split())
		k = p + x * p / 100
		g = k - x * k / 100
		f = (p - g) * q
		c += f
	print(c)


t = int(input())
while t:
	n = int(input())
	s = 0
	while n:
		(p, q, d) = map(int, input().split())
		x = p * d / 100 + p
		y = x - x * d / 100
		s += abs(p - y) * q
		n -= 1
	a = len(str(s)) - 1
	print(str(s) + '0' * (11 - a))
	t -= 1


for _ in range(int(input())):
	t = int(input())
	l = 0
	for i in range(t):
		(p, q, d) = map(int, input().split())
		r = p + p * (d / 100)
		lo = r - r * (d / 100)
		l += (p - lo) * q
	print(l)


T = int(input())
for i in range(T):
	N = int(input())
	C = 0
	for j in range(N):
		F = 0
		(P, Q, D) = list(map(int, input().split()))
		F = P + P * (D / 100)
		F = F - F * (D / 100)
		C += (P - F) * Q
	print(C)


for _ in range(int(input())):
	x = int(input())
	loss = 0
	for i in range(x):
		(a, b, d) = map(int, input().split())
		sp = a + a * d / 100
		sp -= sp * d / 100
		if sp < a:
			loss += (a - sp) * b
	print('{:.9f}'.format(loss))


for _ in range(int(input())):
	n = int(input())
	loss = 0
	for t in range(n):
		(p, q, d) = map(int, input().split())
		ip = p + p * (d / 100)
		fp = ip - ip * (d / 100)
		loss += (p - fp) * q
	print(loss)


for _ in range(int(input())):
	n = int(input())
	loss = 0
	for num in range(n):
		(p, q, d) = map(int, input().split())
		sp = p + p * d / 100
		sp -= sp * d / 100
		if sp < p:
			loss += (p - sp) * q
	print('{:.9f}'.format(loss))


t = int(input())
while t:
	n = int(input())
	loss = 0
	for _ in range(n):
		(p, q, d) = list(map(int, input().split()))
		percent_num = d / 100 * p
		sale_price = p + percent_num
		percent_num = d / 100 * sale_price
		customer_price = sale_price - percent_num
		l = p - customer_price
		loss += l * q
	print(loss)
	t -= 1


t = int(input())
for tc in range(t):
	n = int(input())
	y = []
	for j in range(n):
		(p, q, d) = map(float, input().split())
		m = p + d / 100 * p
		n = m - d / 100 * m
		l = q * (p - n)
		y.append(l)
	print(sum(y))


for _ in range(int(input())):
	loss = 0
	for i in range(int(input())):
		(p, q, d) = map(int, input().split())
		am = p + p * d / 100
		am = am - am * d / 100
		loss = loss + (p - am) * q
	print(loss)


for _ in range(int(input())):
	n = int(input())
	v = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		p1 = p + p * d / 100
		p2 = p1 * d / 100
		p1 = p1 - p2
		p = q * (p - p1)
		v += p
	print(v)


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	for i in range(n):
		(a, b, c) = map(int, input().split())
		d = c * a / 100
		x = a + d
		e = x * c / 100
		y = x - e - a
		z = b * y
		s += z
	print(-1 * s)


for _ in range(int(input())):
	n = int(input())
	loss = 0
	for _ in range(n):
		(price, quant, disc) = map(int, input().split())
		new_price = price + disc / 100 * price
		sp = price - (100 - disc) / 100 * new_price
		loss += sp * quant
	print(loss)


for _ in range(int(input())):
	N = int(input())
	c = 0
	for i in range(N):
		(p, q, d) = map(int, input().split())
		c += p * q * d ** 2 / 10000
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	sum1 = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		k = p + p * d / 100
		s = k - k * d / 100
		l = p - s
		sum1 += l * q
	print(sum1)


t = int(input())
while t:
	N = int(input())
	dis = 0.0
	for j in range(0, N):
		(P, Q, D) = map(float, input().split())
		p = P
		p = p + p * (D / 100)
		p = p - p * (D / 100)
		loss = (P - p) * Q
		dis = dis + loss
	print(dis)
	t = t - 1


t = int(input())
for ni in range(t):
	n = int(input())
	loss = 0
	for nj in range(n):
		(p, q, d) = map(int, input().split())
		inc = p + p * d / 100
		dec = inc - inc * d / 100
		loss = loss + q * (p - dec)
	print(loss)


for i in range(int(input())):
	N = int(input())
	sum1 = 0
	for j in range(N):
		Q = list(map(int, input().split()))
		price = Q[0]
		quantity = Q[1]
		discount = Q[2]
		d = discount / 100
		d1 = price + price * d
		d2 = d1 * d
		d3 = d1 - d2
		loss = (price - d3) * quantity
		sum1 = sum1 + loss
	print(sum1)


for _ in range(int(input())):
	n = int(input())
	lst = []
	for i in range(n):
		(original_price, quantity, discount) = [*map(int, input().strip().split())]
		increased_price = original_price + discount / 100 * original_price
		reduced_price = increased_price - discount / 100 * increased_price
		lst.append(abs(original_price - reduced_price) * quantity)
	print('{:.9f}'.format(sum(lst)))


for i in range(int(input())):
	n = int(input())
	s = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		I = p + p * (d / 100)
		D = I - I * (d / 100)
		K = p - D
		s = s + K * q
	print(s)


for _ in range(int(input())):
	n = int(input())
	total = 0
	for _ in range(n):
		(p, q, d) = map(int, input().split())
		p_mid = p + p * (d / 100)
		p_new = p_mid - p_mid * (d / 100)
		if p_new < p:
			total += (p - p_new) * q
	print(total)


t = int(input())
for _ in range(t):
	n = int(input())
	loss = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		loss = loss + p * q - p * q * (1 + d / 100) * (1 - d / 100)
	print(loss)


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	for j in range(n):
		(price, quantity, x) = list(map(int, input().split()))
		np = price + x * price / 100
		lp = np - x * np / 100
		s = s + quantity * (price - lp)
	print(s)


for _ in range(int(input())):
	ans = 0
	for t in range(int(input())):
		(p, q, x) = map(int, input().split())
		ans += p * q * (x / 100) ** 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	total = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		temp = p + p * d / 100
		price = temp - temp * d / 100
		total += q * (p - price)
	total_string = str(total)
	ans = total_string + '0' * (12 - len(total_string))
	print(ans)


for i in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		(price, quantity, discount) = map(int, input().split())
		iprice = price + discount / 100 * price
		dprice = iprice - discount / 100 * iprice
		f = (price - dprice) * quantity
		l.append(f)
	print(sum(l))


for _ in range(int(input())):
	n = int(input())
	su = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		su += q * p * d * d / 10000
	print(su)


for _ in range(int(input())):
	y = 0
	for _ in range(int(input())):
		(p, q, d) = map(int, input().split())
		s = p + p * (d / 100)
		t = s - s * (d / 100)
		x = p - t
		y += q * x
	print(y)


t = int(input())
while t != 0:
	n = int(input())
	s = 0.0
	while n != 0:
		(p, q, d) = map(int, input().split())
		k = p + p * d / 100
		s += q * (p - (k - k * d / 100))
		n -= 1
	print(s)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	count = 0
	for i in range(n):
		(price, quantity, discount) = map(int, input().split())
		real = price + price * discount / 100
		dis = real - real * discount / 100
		count += (price - dis) * quantity
	print('{:.7f}'.format(count))


for i in range(int(input())):
	n = int(input())
	s = 0
	for i in range(n):
		(a, b, c) = map(int, input().split())
		d = c / 100 * a
		e = a + d
		f = e - c / 100 * e
		g = a - f
		h = b * g
		s = s + h
	print(s)


for tc in range(int(input())):
	n = int(input())
	r = []
	lastlost = 0
	for i in range(n):
		(up, down, lost) = (0, 0, 0)
		(p, q, d) = map(int, input().split())
		up = p + p * d / 100
		down = up - up * d / 100
		lost = (p - down) * q
		lastlost = lastlost + lost
	print(lastlost)


def o(n, p, c):
	if c == 1:
		return n + n * p / 100
	else:
		return n - n * p / 100
for _ in range(int(input())):
	a = int(input())
	loss = 0
	for i in range(a):
		(p, d, x) = map(int, input().split())
		price = o(p, x, 1)
		discount = o(price, x, 2)
		if price > discount:
			loss += (p - discount) * d
	print('{:.10f}'.format(loss))


a = int(input(''))
for i in range(a):
	p = int(input(''))
	l = []
	for j in range(p):
		(t, y, u) = [int(x) for x in input('').split()]
		d = u / 100 * t
		d1 = d + t
		d2 = u / 100 * d1
		d3 = d1 - d2
		d4 = t - d3
		d5 = d4 * y
		l.append(d5)
	print(sum(l))


t = int(input())
for i in range(t):
	v = 0
	n = int(input())
	for j in range(n):
		(a, b, c) = map(int, input().split())
		ip = a + c / 100 * a
		fp = ip - c / 100 * ip
		np = (a - fp) * b
		v = v + np
	print(v)


for _ in range(int(input())):
	s = 0
	for __ in range(int(input())):
		(a, b, c) = map(int, input().split())
		s += b * (a * (1 - (1 - c ** 2 / 10000)))
	print(s)


for _ in range(int(input())):
	n = int(input())
	total_loss = 0
	for i in range(n):
		(price, qty, discount) = map(int, input().split())
		old_price = price + price * discount / 100
		new_price = old_price - old_price * discount / 100
		disc_offered = price - new_price
		total_loss += disc_offered * qty
	print(total_loss)


for t in range(int(input())):
	totallossforthiscase = 0
	for i in range(int(input())):
		(price, quantity, discount) = map(int, input().split())
		originalprice = price
		price = price * (1 + discount / 100)
		price = price * (1 - discount / 100)
		diff = originalprice - price
		loss = diff * quantity
		totallossforthiscase += loss
	print(totallossforthiscase)


T = int(input())
for _ in range(T):
	N = int(input())
	finale = []
	for _ in range(N):
		(Price, Quantity, Discount) = map(int, input().split())
		increase = Price + Discount * 0.01 * Price
		decrease = increase - Discount * 0.01 * increase
		final = (Price - decrease) * Quantity
		finale.append(final)
	print(sum(finale))


for testcases in range(int(input())):
	a = int(input())
	count = 0
	for i in range(a):
		(a, b, c) = map(int, input().split())
		d = a * b
		a += 0.01 * c * a
		a -= 0.01 * a * c
		a *= b
		count += d - a
	print(float(count))


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		n_p = p + p * 0.01 * d
		n_p = n_p - n_p * 0.01 * d
		diff = p - n_p
		s += diff * q
	print(s)


for tc in range(int(input())):
	n = int(input())
	loss = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		dp = p + p * d / 100
		ddp = dp - dp * d / 100
		l = p - ddp
		loss += l * q
	print(loss)


for i in range(int(input())):
	n = int(input())
	z = 0.0
	for i in range(n):
		(x, q, d) = map(int, input().split())
		a = d / 100 * x
		b = x + a
		c = d / 100 * b
		m = b - c
		e = x - m
		z += e * q
	s = str(z)
	c = 0
	for i in s:
		if i == '.':
			break
		else:
			c += 1
	y = len(s)
	u = 12 - y
	s += u * '0'
	print(s)


n = int(input())
for i in range(n):
	a = int(input())
	p = 0
	for i in range(a):
		(x, y, z) = map(int, input().split())
		s = x * (z / 100)
		q = x + s
		k = q * (z / 100)
		e = q - k
		m = e - x
		p = p + m * y
	print(abs(p))


for _ in range(int(input())):
	m = int(input())
	l = 0
	for i in range(m):
		(t, u, b) = map(int, input().split())
		rt = t + t * b / 100
		rt -= rt * b / 100
		if rt < t:
			l += (t - rt) * u
	print('{:.9f}'.format(l))


for i in range(int(input())):
	n = int(input())
	ans = 0
	for j in range(0, n):
		(p, q, d) = list(map(int, input().split()))
		ans += (p - (p + d * p / 100 - (p + d * p / 100) * (d / 100))) * q
	print('{0:.9f}'.format(ans))


for _ in range(int(input())):
	n = int(input())
	loss = 0
	for i in range(n):
		l = [int(x) for x in input().split()]
		a = l[0] + l[0] * (l[2] / 100)
		b = a * (l[2] / 100)
		loss += (b - l[0] * (l[2] / 100)) * l[1]
	print(round(loss, 11))


tempRecipeLossList = []
answerList = []

def split_loss_calculator(userInput):
	(price, quantity, discount) = list(map(int, userInput.split()))
	loss = price - price * ((100 + discount) / 100) * ((100 - discount) / 100)
	tempRecipeLossList.append(loss * quantity)
test_cases = int(input())
for i in range(test_cases):
	numRecipeTypes = int(input())
	for j in range(numRecipeTypes):
		split_loss_calculator(input())
	answerList.append(sum(tempRecipeLossList))
	tempRecipeLossList.clear()
for item in range(len(answerList)):
	print('{}'.format(answerList[item]))


for _ in range(int(input())):
	n = int(input())
	s = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		x = d / 100 * p
		pr = p + x
		y = pr - d / 100 * pr
		l = p - y
		tl = q * l
		s = s + tl
	print(s)


for _ in range(int(input())):
	n = int(input())
	tot = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		new_price = p * (100 + d) / 100
		new_price *= (100 - d) / 100
		tot += (p - new_price) * q
	print(tot)


for _ in range(int(input())):
	S = int(input())
	loss = 0
	for i in range(S):
		(P, Q, X) = map(int, input().split())
		Orig = P
		P = P + P * X / 100
		loss += (Orig - (P - P * X / 100)) * Q
	print(loss)


for _ in range(int(input())):
	s = 0
	for _ in range(int(input())):
		(p, q, d) = map(int, input().split())
		c = p * (1 + d / 100)
		e = c * (1 - d / 100)
		s = s + (p - e) * q
		s = round(s, 7)
	print('%.7f' % s)


for _ in range(int(input())):
	loss = 0
	for i in range(int(input())):
		(price, quantity, discount) = map(int, input().split())
		loss += price * quantity - quantity * price * (1 + discount / 100) * (1 - discount / 100)
	print(loss)


for i in range(int(input())):
	n = int(input())
	l = 0
	for j in range(n):
		(a, b, c) = map(int, input().split())
		l += a * b - b * a * (1 + c / 100) * (1 - c / 100)
	print(l)


for i in range(int(input())):
	n = int(input())
	count = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		r1 = p + p * d / 100
		r2 = r1 - r1 * d / 100
		res = (p - r2) * q
		count += res
	print(count)


for t in range(int(input())):
	n = int(input())
	c = 0
	for i in range(n):
		(p, q, d) = map(float, input().split())
		c += p * q * d ** 2 / 10000
	print(c)


for _ in range(int(input())):
	x = int(input())
	a = 0
	for i in range(x):
		(x, y, z) = map(int, input().split())
		a += y * (x - x * (100 + z) / 100 * (100 - z) / 100)
	print(a)


for _ in range(int(input())):
	ls = 0
	for __ in range(int(input())):
		(pr, qu, di) = map(int, input().split())
		pr1 = pr + di / 100 * pr
		sell_pr = pr1 - pr1 * di / 100
		if sell_pr < pr1:
			ls += (pr - sell_pr) * qu
	print('{:.9f}'.format(ls))


for _ in range(int(input())):
	n = int(input())
	s = 0
	for i in range(n):
		(p, q, d) = map(int, input().split())
		p1 = p + p * (0.01 * d)
		a = p1 - 0.01 * d * p1
		s += (p - a) * q
	print(s)


for e in range(int(input())):
	c = 0
	num = int(input())
	for i in range(num):
		(p, q, r) = map(int, input().split())
		x = p + r / 100 * p
		x -= r / 100 * x
		c += (p - x) * q
	print('{0:.6f}'.format(c))