In a coding contest, there are prizes for the top rankers. The prize scheme is as follows:

Top 10 participants receive rupees X each.
Participants with rank 11 to 100 (both inclusive) receive rupees Y each.

Find the total prize money over all the contestants.

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

- First line will contain T, number of test cases. Then the test cases follow.
- Each test case contains of a single line of input, two integers X and Y - the prize for top 10 rankers and the prize for ranks 11 to 100 respectively.

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

For each test case, output the total prize money over all the contestants.

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

$1 ≤ T ≤ 1000$
$1 ≤ Y ≤ X ≤ 1000$

----- Sample Input 1 ------ 
4
1000 100
1000 1000
80 1
400 30

----- Sample Output 1 ------ 
19000
100000
890
6700

----- explanation 1 ------ 
Test Case $1$: Top $10$ participants receive rupees $1000$ and next $90$ participants receive rupees $100$ each. So, total prize money $= 10 \cdot 1000 + 90 \cdot 100 = 19000$.

Test Case $2$: Top $10$ participants receive rupees $1000$ and next $90$ participants receive rupees $1000$ each. So, total prize money $= 10 \cdot 1000 + 90 \cdot 1000 = 100000$.

Test Case $3$: Top $10$ participants receive rupees $80$ and next $90$ participants receive rupee $1$ each. So, total prize money $= 10 \cdot 80 + 90 \cdot 1 = 890$.

Test Case $4$: Top $10$ participants receive rupees $400$ and next $90$ participants receive rupees $30$ each. So, total prize money $= 10 \cdot 400 + 90 \cdot 30 = 6700$.

Source: codechef | Difficulty: EASY
Tags: Mathematics

Implementation


Solutions:
t = int(input())
for _ in range(t):
	(X, Y) = map(int, input().split())
	print(X * 10 + Y * 90)


t = int(input())
for i in range(0, t):
	(x, y) = map(int, input().split())
	print(10 * x + 90 * y)


for j in range(int(input())):
	(x, y) = map(int, input().split())
	print(10 * x + 90 * y)


prize = int(input())
for p in range(prize):
	(A, B) = map(int, input().split())
	print(10 * A + 90 * B)


T = int(input())
for i in range(T):
	(x, y) = map(int, input().split())
	total_prize = x * 10 + y * 90
	print(total_prize)


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


c = int(input())
for i in range(c):
	(x, y) = map(int, input().split(' '))
	print(x * 10 + y * 90)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	print(10 * n + 90 * m)


T = int(input())
for i in range(T):
	(X, Y) = input().split()
	X = int(X)
	Y = int(Y)
	sum = X * 10 + Y * 90
	print(sum)


t = int(input())
for i in range(t):
	(x, y) = input().split(' ')
	x = int(x)
	y = int(y)
	total_pmoney = 10 * x + 90 * y
	print(total_pmoney)


T = int(input())
for i in range(0, T):
	(X, Y) = map(int, input().split())
	print(X * 10 + Y * 90)


t = int(input())
for u in range(t):
	(X, Y) = list(map(int, input().split()))
	print(X * 10 + Y * 90)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	ans = x * 10 + y * 90
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(10 * a + 90 * b)


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


for I in range(int(input())):
	(x, y) = map(int, input().split())
	a = 10 * x
	b = 90 * y
	print(a + b)


t = int(input())
for m in range(0, t):
	a = input()
	b = a.split()
	x = int(b[0])
	y = int(b[1])
	print(10 * x + 90 * y)


for t in range(int(input())):
	(i, j) = map(int, input().split(' '))
	print(10 * i + 90 * j)


t = int(input())
while t > 0:
	lst = input().split()
	(x, y) = (int(lst[0]), int(lst[1]))
	print(10 * x + 90 * y)
	t -= 1


t = int(input())
for item in range(t):
	(x, y) = map(int, input().split())
	print(x * 10 + y * 90)


T = int(input())
for T in range(T):
	(X, Y) = map(int, input().split())
	total_prize = X * 10 + Y * 90
	print(total_prize)


test = int(input())
ans = []
while test:
	test = test - 1
	(X, Y) = [int(x) for x in input().split()]
	ans.append(X * 10 + Y * 90)
for i in ans:
	print(i)


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


T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split())
	a = 10 * X
	b = 90 * Y
	print(a + b)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	D = x * 10
	J = y * 90
	print(D + J)


n = int(input())
for i in range(n):
	(p, q) = map(int, input().split())
	print(p * 10 + q * 90)


test_cases = int(input())
for i in range(test_cases):
	prizes = list(map(int, input().split()))
	total = prizes[0] * 10 + prizes[-1] * 90
	print(total)


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


TC = int(input())
for i in range(TC):
	(X, Y) = map(int, input().split())
	print(10 * X + 90 * Y)


m = int(input())
for x in range(m):
	(x, y) = map(int, input().split())
	sum = 10 * x + 90 * y
	print(sum)


tot = 0
t = int(input())
for i in range(t):
	(X, Y) = map(int, input().split())
	tot = X * 10 + Y * 90
	print(tot)


t = int(input())

def contest(t):
	for i in range(1, t + 1):
		(x, y) = list(map(int, input().split()))
		print(x * 10 + y * 90)
contest(t)


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


def calculate_prize(rank, x, y):
	if rank <= 10:
		return x
	elif rank <= 100:
		return y
	else:
		return 0
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	total_participants = 100
	total_prize_money = 0
	for rank in range(1, total_participants + 1):
		prize_money = calculate_prize(rank, x, y)
		total_prize_money += prize_money
	print(total_prize_money)


n = int(input())
for _ in range(n):
	(x, y) = list(map(int, input().split()))
	print(10 * x + 90 * y)