While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000. 
If the quantity and price per item are input, write a program to calculate the total expenses.

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

The first line contains an integer T, total number of test cases. Then follow T lines, each line contains integers quantity and price. 

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

For each test case, output the total expenses while purchasing items, in a new line.

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

1 ≤ T ≤ 1000
1 ≤ quantity,price ≤ 100000

----- Sample Input 1 ------ 
3 
100 120
10 20
1200 20

----- Sample Output 1 ------ 
12000.000000
200.000000
21600.000000

Source: codechef | Difficulty: EASY
Tags: Data structures


Solutions:
for i in range(int(input())):
	(quantity, price) = map(int, input().split())
	if quantity > 1000:
		total = quantity * price - 0.1 * (quantity * price)
	else:
		total = quantity * price
	print(total)


t = int(input())
for i in range(t):
	(q, p) = map(float, input().split())
	if q > 1000:
		print(q * p * 0.9)
	else:
		print(q * p)


T = int(input())
for i in range(T):
	(quantity, price) = map(int, input().split())
	if quantity > 1000:
		print(quantity * price - quantity * price / 10)
	else:
		print(quantity * price)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > 1000:
		x = a * b * 10 / 100
		print(a * b - x)
	else:
		print(a * b)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	a = float(x * 10 / 100)
	if x < 1000:
		print(float(x * y))
	else:
		b = float(x - a)
		print(float(b * y))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a < 1000:
		print(a * b)
	else:
		print(a * b - a * b * 0.1)


for i in range(int(input())):
	(q, p) = map(int, input().split())
	if q > 1000:
		p1 = p * q
		p2 = 10 * (p1 / 100)
		r = p1 - p2
		print(r)
	else:
		print(p * q)


for _ in range(int(input())):
	(q, p) = map(int, input().split())
	print(q * p * 9 / 10) if q > 1000 else print(q * p)


for i in range(int(input())):
	(q, p) = map(int, input().split())
	pr = q * p
	if q > 1000:
		print(pr - pr * 0.1)
	else:
		print(q * p)


n = int(input())
for i in range(n):
	(q, p) = map(float, input().split())
	amt = q * p
	if q > 1000:
		amt = amt - amt * 0.1
	print(amt)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	c = x * y
	if x > 1000:
		print(c * 0.9)
	else:
		print(c)


T = int(input())
for i in range(0, T):
	(q, p) = input().split()
	(q, p) = [int(q), int(p)]
	tp = q * p
	if q > 1000:
		fp = tp - 0.1 * tp
	else:
		fp = tp
	print(fp)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > 1000:
		c = a * 10 / 100
		d = a - c
		print('{:.6f}'.format(d * b))
	else:
		print('{:.6f}'.format(a * b))


t = int(input())
for i in range(t):
	(p, q) = map(int, input().split())
	if p > 1000:
		print(p * q - p * q / 100 * 10)
	else:
		print(p * q)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	if a > 1000:
		sum = a * (b - b / 10)
	else:
		sum = a * b
	print(sum)


testcases = int(input())
for i in range(testcases):
	(q, p) = map(int, input().split())
	if q > 1000:
		qp = q * p - q * p / 100 * 10
		print(qp)
	else:
		print(q * p)


for i in range(int(input())):
	total = 0
	(m, n) = map(int, input().split())
	total += m * n
	if m > 1000:
		discount = total - total * 10 / 100
		print(discount)
	else:
		print(total)


r = int(input())
for item in range(r):
	(quan, pric) = map(float, input().split())
	if quan > 1000:
		convert = quan * pric - quan * pric / 10
		print('%.6f' % convert)
	else:
		print('%.6f' % (quan * pric))


def code():
	cases = int(input())
	for _ in range(cases):
		(quantity, price) = map(int, input().split(' '))
		base = quantity * price
		expenses = 0
		if quantity > 1000:
			expenses = base - 0.1 * base
		else:
			expenses = quantity * price
		print(expenses)
code()


t = int(input())
for _ in range(t):
	(q, p) = list(map(int, input().split()))
	if q > 1000:
		res = 0.9 * p * q
		print(res)
	else:
		print(q * p)


r = int(input())
for i in range(r):
	(x, y) = map(int, input().split())
	d = 0
	if x > 1000:
		d = 10 / 100 * (x * y)
	print(float(x * y - d))


for i in range(int(input())):
	(q, p) = map(int, input().split())
	if q > 1000:
		dis = 10 * q / 100
		print('{:.6f}'.format((q - dis) * p))
	else:
		print('{:.6f}'.format(q * p))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = a * b
	if a > 1000:
		print(0.9 * c)
	else:
		print(c)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	e = x * y
	if x > 1000:
		print(e - e / 10)
	else:
		print(e)


T = int(input())
for i in range(T):
	(q, p) = map(int, input().split())
	if q > 1000:
		print(q * p - q * p / 10)
	else:
		print(q * p)


t = int(input())
for i in range(t):
	(q, p) = [int(i) for i in input().split()]
	if q > 1000:
		print(q * p - q * p * 0.1)
	else:
		print(q * p)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	a = x * y
	if x > 1000:
		per = 10 / 100 * a
		tot = a - per
		print('%6f' % tot)
	else:
		print('%6f' % a)


t = int(input())
for i in range(t):
	(q, p) = map(int, input().split())
	if q > 1000:
		ans = q * p - q * p / 10
	else:
		ans = q * p
	print(f'{ans:.6f}')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > 1000:
		print(f'{a * b - a * b / 10:.6f}')
	else:
		print(f'{a * b:.6f}')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n <= 1000:
		print(float(n * m))
	else:
		print(n * m - n * m / 10)


p = int(input())
for i in range(p):
	(x, y) = map(int, input().split())
	if x < 1000:
		print(float(x * y))
	else:
		print(x * y - x * y * 0.1)


t = int(input())
for i in range(t):
	(quantity, price) = map(float, input().split())
	subtotal = quantity * price
	if quantity > 1000:
		print(subtotal * 0.9)
	else:
		print(subtotal)


for _testcase in range(int(input())):
	(a, b) = map(int, input().split())
	if a > 1000:
		print(a * b - a * b / 100 * 10)
	else:
		print(a * b)


for _ in range(int(input())):
	(qt, pr) = map(int, input().split())
	if qt >= 1000:
		print(qt * pr * 0.9)
	else:
		print(qt * pr)


n = int(input())
for i in range(0, n):
	(q, p) = map(int, input().split())
	if q <= 1000:
		a = q * p
		print('{:.6f}'.format(a))
	else:
		b = 10 / 100 * q
		c = q - b
		d = c * p
		print('{:.6f}'.format(d))


t = int(input())
for _ in range(t):
	(x, y) = map(float, input().split())
	if x > 1000:
		print(x * y - x * y * 0.1)
	else:
		print(x * y)


for _ in range(int(input())):
	(a, b) = map(float, input().split())
	if a < 1000:
		print(a * b)
	else:
		print(a * b * 0.9)


for _ in range(int(input())):
	(q, p) = map(float, input().split())
	if q <= 1000:
		print(q * p)
	else:
		l = q / 100 * 10 * p
		print(q * p - l)


t = int(input())
for i in range(t):
	(A, B) = map(float, input().split())
	if A <= 1000:
		print(A * B)
	else:
		print(0.9 * A * B)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a >= 1000:
		dis1 = a * b / 10
		dis = a * b - dis1
		print(float(dis))
	else:
		print(float(a * b))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > 1000:
		a = 9 * a / 10
	print(a * b)


t = int(input())
while t:
	t -= 1
	(q, p) = map(int, input().split())
	if q > 1000:
		r = q * p
		print(r - r / 10)
	else:
		print(q * p)


T = int(input())
for _ in range(T):
	(Q, P) = map(int, input().split())
	tot_cost = Q * P
	if Q > 1000:
		tot_expenses = tot_cost - tot_cost * 10 / 100
		print(tot_expenses)
	else:
		print(tot_cost)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x > 1000:
		p = x * y * 0.1
		print(x * y - p)
	else:
		print(x * y)


T = int(input())
for i in range(T):
	X = input()
	x = X.split()
	i = 0
	z = float(x[i]) * float(x[i + 1])
	if int(x[i]) > 1000:
		y = z / 100 * 10
		z = z - y
	print('%.6f' % z)


for _t in range(int(input())):
	(q, p) = map(int, input().split())
	if q > 1000:
		print(q * p - q * p / 100 * 10)
	else:
		print(q * p)


for i in range(int(input())):
	(high, low) = map(int, input().split())
	if high > 1000:
		print(high * low - high * low / 100 * 10)
	else:
		print(high * low)


T = int(input())
for _ in range(T):
	(q, p) = map(int, input().split())
	total = q * p
	print(total * 0.9) if q > 1000 else print(total)


for _testcase in range(int(input())):
	(a1, b1) = map(int, input().split())
	if a1 > 1000:
		print(a1 * b1 - a1 * b1 / 100 * 10)
	else:
		print(a1 * b1)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	a = x * y
	if x < 1000:
		print(a)
	else:
		print(a - a * 0.1)


for i in range(int(input())):
	(quantity, price) = map(float, input().split())
	if quantity > 1000:
		print(format(0.9 * quantity * price, '.6f'))
	else:
		print(format(quantity * price, '.6f'))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	a = x * y
	b = x * y * 0.1
	c = a - b
	if x <= 1000:
		print('{:.6f}'.format(a))
	else:
		print('{:.6f}'.format(c))


t = int(input())
for i in range(t):
	(q, p) = map(float, input().split())
	amount = q * p
	if q > 1000:
		amount = amount - amount * 0.1
	print(amount)