On a certain train, Chef-the ticket collector, collects a fine of Rs. X if a passenger is travelling without a ticket. It is known that a passenger carries either a single ticket or no ticket. 

P passengers are travelling and they have a total of Q tickets. Help Chef calculate the total fine collected.

------ Input Format ------ 

The first line contains a single integer T, the number of test cases. T lines follow. Each following line contains three integers separated by spaces, whose description follows.
- The first integer, X, is the fee in rupees.
- The second integer, P, is the number of passengers on the train.
- The third integer, Q, is the number of tickets Chef collected.

------ Output Format ------ 

The output must consist of T lines.
- The i^{th} line must contain a single integer, the total money(in rupees) collected by Chef corresponding to the i^{th} test case.

------ Constraints ------ 

$1 ≤T ≤10$
$1 ≤X ≤10$
$0 ≤Q ≤P ≤10$

----- Sample Input 1 ------ 
4
4 1 1
2 10 7
8 5 4
9 7 0
----- Sample Output 1 ------ 
0
6
8
63
----- explanation 1 ------ 
Test case $1$: The total number of passengers travelling without ticket are $1 - 1 = 0$. So the total fine collected is $0 \cdot 4 = 0$ rupees.

Test case $2$: The total number of passengers travelling without ticket are $10 - 7 = 3$. So the total fine collected is $3 \cdot 2 = 6$ rupees.

Test case $3$: The total number of passengers travelling without ticket are $5 - 4 = 1$. So the total fine collected is $1 \cdot 8 = 8$ rupees.

Test case $4$: The total number of passengers travelling without ticket are $7 - 0 = 7$. So the total fine collected is $7 \cdot 9 = 63$ rupees.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
for i in range(int(input())):
	(x, y, q) = list(map(int, input().split(' ')))
	print(x * (y - q))


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


t = int(input())
for i in range(t):
	(x, p, q) = map(int, input().split())
	if q >= p:
		print(0)
	else:
		z = p - q
		print(z * x)


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


n = int(input())
for _ in range(n):
	(x, p, q) = map(int, input().split())
	c1 = p - q
	print(x * c1)


t = int(input())
for i in range(t):
	(x, p, q) = map(int, input().split())
	people = p - q
	fine = x * people
	print(fine)


t = int(input())
for _ in range(t):
	(x, p, q) = map(int, input().split())
	s = p - q
	k = s * x
	print(k)


T = int(input())
for i in range(T):
	(X, P, Q) = map(int, input().split(' '))
	print((P - Q) * X)


n = int(input())
for i in range(n):
	(p, q, r) = map(int, input().split())
	print((q - r) * p)


t = int(input())
for i in range(t):
	(a, b, c) = list(map(int, input().split()))
	mn = b - c
	print(a * mn)


tc = int(input())
while tc:
	(x, p, q) = map(int, input().split(' '))
	print(x * (p - q))
	tc = tc - 1


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	x = b - c
	if x == 0:
		print(a * 0)
	else:
		print(x * a)


t = int(input())
for i in range(t):
	(x, p, q) = map(int, input().split())
	if q > p // 2:
		fine = (p - q) * x
	else:
		fine = q * 0 + (p - q) * x
	print(fine)


t = int(input())
for i in range(t):
	(x, q, p) = [int(x) for x in input().split()]
	print((q - p) * x)


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


t = int(input())
for i in range(t):
	(X, P, Q) = map(int, input().split())
	A = P - Q
	B = A * X
	print(B)


t = int(input())
for t in range(t):
	(x, p, q) = map(int, input().split())
	a = p - q
	print(a * x)


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


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


T = int(input())
for i in range(T):
	(x, p, q) = map(int, input().split())
	if p == q:
		print(0)
	else:
		total = (p - q) * x
		print(total)


T = int(input())
for i in range(T):
	(x, y, z) = map(int, input().split())
	a = y - z
	b = x * a
	print(b)


T = int(input())
for _ in range(T):
	(x, p, q) = map(int, input().split())
	if p == q:
		print(0 * x)
	elif p > q:
		print((p - q) * x)


t = int(input())
for i in range(t):
	(x, p, q) = map(int, input().split())
	if p == q:
		print('0')
	elif q < p:
		print((p - q) * x)


n = int(input())
for i in range(n):
	m = input().split()
	print((int(m[1]) - int(m[2])) * int(m[0]))


n = int(input())
for i in range(0, n):
	(x, p, q) = map(int, input().split(' '))
	print((p - q) * x)


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split(' '))
	k = b - c
	print(a * k)


t = int(input())
while t:
	(x, p, q) = map(int, input().split())
	print(x * (p - q))
	t -= 1


n = int(input())
while n > 0:
	(a, b, c) = map(int, input().split())
	print((b - c) * a)
	n -= 1


T = int(input())
for i in range(0, T):
	(X, P, Q) = input().split()
	x = int(X)
	p = int(P)
	q = int(Q)
	w = p - q
	f = x * w
	print(f)


for i in range(int(input())):
	(x, p, q) = map(int, input().split())
	a = p - q
	b = a * x
	print(abs(b))


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	if b - c > 0:
		print(a * (b - c))
	else:
		print('0')


x = int(input())
while x != 0:
	(a, b, c) = map(int, input().split())
	print(a * (b - c))
	x -= 1


t = int(input())
for i in range(t):
	(X, Y, Z) = map(int, input().split())
	print((Y - Z) * X)


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


test = int(input())
for i in range(test):
	(a, b, c) = map(int, input().split())
	r = b - c
	print(r * a)


t = int(input())
for i in range(t):
	(x, p, q) = list(map(int, input().split()))
	n = (p - q) * x
	print(n)


n = int(input())
for i in range(n):
	(n1, n2, n3) = map(int, input().split())
	if n2 == n3:
		print(0)
	else:
		print(n1 * (n2 - n3))


n = int(input())
for i in range(n):
	(j, k, l) = map(int, input().split())
	print(j * (k - l))


for i in range(int(input())):
	(X, P, Q) = map(int, input().split())
	if P == Q:
		print('0')
	else:
		print((P - Q) * X)