Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Suppose for a unit rise in temperature, the solubility of sugar in water increases by $B \frac{\mathrm{g}}{100\ \mathrm{mL}}$.

Chef does an experiment to check how much sugar (in $\mathrm{g}$) he can dissolve given that he initially has $1$ liter of water at $X$ degrees and the solubility of sugar at this temperature is $A \frac{\mathrm{g}}{100\ \mathrm{mL}}$. Also, Chef doesn't want to lose any water so he can increase the temperature to at most $100$ degrees.

Assuming no loss of water takes place during the process, find the maximum amount of sugar (in $\mathrm{g}$) can be dissolved in $1$ liter of water under the given conditions.

------ Input ------

The first line contains an integer $T$, the number of test cases. Then the test cases follow. 
The only line of each test case contains three integers $X, A, B$. 

------ Output ------
For each testcase, output in a single line the answer to the problem.

------ Constraints  ------
$1 ≤ T ≤ 1000$
$31 ≤ X ≤ 40$
$101 ≤ A ≤ 120$
$1 ≤ B ≤ 5$

------ Subtasks ------
Subtask #1 (100 points): Original Constraints

----- Sample Input 1 ------ 
3

40 120 1

35 120 2

40 115 3
----- Sample Output 1 ------ 
1800

2500

2950
----- explanation 1 ------ 
Test Case $1$: Since solubility is increasing with temperature, the maximum solubility will be at $100$ degrees which is equal to $120 + (100 - 40) = 180 \frac{\mathrm{g}}{100\ \mathrm{mL}}$. 

So for $1$ liter of water the value is $180 \cdot 10 = 1800\ \mathrm{g}$.

Test Case $2$: Since solubility is increasing with temperature, the maximum solubility will be at $100$ degrees which is equal to $120 + (100 - 35) \cdot 2 = 250\frac{\mathrm{g}}{100\ \mathrm{mL}}$. 

So for $1$ liter of water the value is $250 \cdot 10 = 2500\ \mathrm{g}$.

Difficulty: EASY
Tags: Constructive algorithms

Mathematics

Ad-hoc

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	(x, a, b) = map(int, input().split())
	sol = a + (100 - x) * b
	print(sol * 10)


t = int(input())
for i in range(t):
	(x, a, b) = map(int, input().split())
	print(((100 - x) * b + a) * 10)


n = int(input())
for _ in range(n):
	(X, A, B) = list(map(int, input().split()))
	product = A + (100 - X) * B
	print(product * 10)


for _ in range(int(input())):
	(x, a, b) = map(int, input().split())
	ans1 = (a + (100 - x) * b) * 10
	print(ans1)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	s = b + (100 - a) * c
	print(s * 10)


T = int(input())
for _ in range(T):
	(X, A, B) = map(int, input().split())
	temp_diff = 100 - X
	solubility_increase = temp_diff * B
	total_sugar_solubility = A + solubility_increase
	print(total_sugar_solubility * 10)


n = int(input())
for i in range(n):
	(a, b, c) = list(map(int, input().split()))
	print((b + (100 - a) * c) * 10)


T = int(input())
for i in range(T):
	(X, A, B) = map(int, input().split())
	s = A + (100 - X) * B
	print(s * 10)


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


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print((b + (100 - a) * c) * 10)


for case in range(int(input())):
	(x, a, b) = map(int, input().split())
	print((a + (100 - x) * b) * 10)


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	res = (Y + (100 - X) * Z) * 10
	print(res)


t = int(input())
for i in range(t):
	(n, k, x) = map(int, input().split())
	print((k + (100 - n) * x) * 10)


n = int(input())
for _ in range(n):
	(x, y, z) = map(int, input().split())
	s = (100 - x) * z
	k = s + y
	p = k * 10
	print(p)


T = int(input())
for _ in range(T):
	(X, A, B) = map(int, input().split())
	print((A + (100 - X) * B) * 10)


for i in range(int(input())):
	(X, A, B) = map(int, input().split())
	S = A + (100 - X) * B
	print(S * 10)


t = int(input())
for _ in range(t):
	(x, y, z) = map(int, input().split())
	print((y + (100 - x) * z) * 10)


t = int(input())
for i in range(t):
	a = [int(i) for i in input().split()]
	print((100 - a[0]) * a[2] * 10 + a[1] * 10)


t = int(input())
for _ in range(t):
	(x, a, b) = list(map(int, input().split()))
	res = a + (100 - x) * b
	print(res * 10)


testcases = int(input())
for i in range(testcases):
	(x, a, b) = map(int, input().split())
	sol = (a + (100 - x) * b) * 10
	print(sol)


t = int(input())
for i in range(t):
	(a, b, c) = list(map(int, input().split()))
	r = b + (100 - a) * c
	s = r * 10
	print(s)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	d = b + (100 - a) * c
	f = d * 10
	print(f)


t = int(input())
for i in range(t):
	(a, s, d) = map(int, input().split())
	print(10 * (s + (100 - a) * d))


try:
	t = int(input())
	for r in range(t):
		(x, a, b) = map(int, input().split())
		c = 100 - x
		n = a + c * b
		print(n * 10)
except:
	pass


T = int(input())
for tc in range(T):
	(a, b, c) = map(int, input().split(' '))
	x = b + (100 - a) * c
	print(x * 10)


t = int(input())
for i in range(0, t, 1):
	l = list(map(int, input().split(' ')))
	print((l[1] + (100 - l[0]) * l[2]) * 10)


m = int(input())
for i in range(m):
	(a, b, c) = map(int, input().split())
	x = b + (100 - a) * c
	print(x * 10)


t = int(input())
while t != 0:
	(x, a, b) = list(map(int, input().split()))
	y = a + (100 - x) * b
	z = y * 10
	print(z)
	t = t - 1


T = int(input())
for i in range(T):
	(X, A, B) = map(int, input().split())
	something = A + abs(100 - X) * B
	print(something * 10)


t = int(input())
for i in range(t):
	(x, a, b) = map(int, input().split())
	c = 100 - x
	d = c * b
	e = a + d
	print(int(e * 10))


for t in range(int(input())):
	(degrees, a, b) = map(int, input().split())
	r = a + (100 - degrees) * b
	print(r * 10)


import math
test = int(input())
i = 1
while i <= test:
	(x, a, b) = input().split()
	z = (int(a) + (100 - int(x)) * int(b)) * 10
	print(z)
	i = i + 1


goals = int(input())
for distractions in range(goals):
	(life, wife, aim) = map(int, input().split())
	stress = (wife + (100 - life) * aim) * 10
	print(stress)


for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	s = y + (100 - x) * z
	print(s * 10)