King loves to go on tours with his friends.

King has N cars that can seat 5 people each and M cars that can seat 7 people each. Determine the maximum number of people that can travel together in these cars.

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

- The first line of input contains a single integer T, the number of test cases.
- The first and only line of each test case contains two space-separated integers N and M — the number of 5-seaters and 7-seaters, respectively.

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

For each test case, output on a new line the maximum number of people that can travel together.

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

$1 ≤ T ≤ 100$
$0 ≤ N,M ≤ 100$

----- Sample Input 1 ------ 
4
4 8
2 13
14 5
8 8
----- Sample Output 1 ------ 
76
101
105
96
----- explanation 1 ------ 
Test case $1$: King has $4$ cars that seat $5$ each and $8$ cars that seat $7$ each. So, $4\times 5 + 8\times 7 = 76$ people can travel together.

Test case $2$: King has $2$ cars that seat $5$ each and $13$ cars that seat $7$ each. So, $2\times 5 + 13\times 7 = 101$ people can travel together.

Test case $3$: King has $14$ cars that seat $5$ each and $5$ cars that seat $7$ each. So, $14\times 5 + 7\times 7 = 105$ people can travel together.

Test case $4$: King has $8$ cars that seat $5$ each and $8$ cars that seat $7$ each. So, $8\times 5 + 8\times 7 = 96$ people can travel together.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	a = n * 5
	b = m * 7
	print(a + b)


cases = int(input())
for case in range(cases):
	n_and_m = input()
	(n, m) = map(int, n_and_m.split())
	ans = n * 5 + m * 7
	print(ans)


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


c = int(input())
for i in range(c):
	(a, b) = map(int, input().split(' '))
	print(a * 5 + b * 7)


TC = int(input())
for i in range(TC):
	(x, y) = map(int, input().split())
	print(5 * x + 7 * y)


t = int(input())
for i in range(t):
	(N, M) = map(int, input().split())
	print(N * 5 + M * 7)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a * 5 + b * 7)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	k = x * 5 + y * 7
	print(k)


t = int(input())
for i in range(t):
	(x, y) = [int(i) for i in input().split()]
	a = x * 5
	b = y * 7
	print(a + b)


t = int(input())
for i in range(t):
	(m, n) = map(int, input().split(' '))
	c = m * 5
	d = n * 7
	print(c + d)


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


for i in range(int(input())):
	(x, y) = map(int, input().split())
	r = x * 5
	p = y * 7
	m = r + p
	print(m)


T = int(input())
for i in range(T):
	(N, M) = map(int, input().split())
	A = N * 5
	B = M * 7
	print(A + B)


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


T = int(input())
for i in range(T):
	(N, M) = map(int, input().split())
	a = N * 5
	b = M * 7
	print(a + b)


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	first = x * 5
	last = y * 7
	res = first + last
	print(res)


res = []
t = int(input())
for i in range(t):
	inpt = [int(x) for x in input().split()]
	n = inpt[0]
	m = inpt[1]
	res.append(5 * n + 7 * m)
for ele in res:
	print(ele)


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


TC = int(input())
for T in range(TC):
	(n, m) = map(int, input().split())
	print(5 * n + 7 * m)


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


t = int(input())
for i in range(t):
	lst = list(map(int, input().split()))
	people = lst[0] * 5 + lst[1] * 7
	print(people)


for _ in range(int(input())):
	(N, M) = map(int, input().split())
	print(N * 5 + M * 7)


t = int(input())
for i in range(t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	z = n * 5 + m * 7
	print(z)


t = int(input())

def car(t):
	x = []
	for i in range(1, t + 1):
		a = list(map(int, input().split()))
		x.append(a)
	for j in x:
		(m, n) = j
		print(m * 5 + n * 7)
car(t)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	max_people = -1
	for k in range(n, -1, -1):
		if 7 * m + 5 * k <= 5 * n + 7 * m:
			max_people = 7 * m + 5 * k
			break
	print(max_people)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	h = a * 5
	l = b * 7
	print(h + l)


t = int(input())
for _ in range(t):
	(f, s) = map(int, input().split())
	print(f * 5 + s * 7)


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	print(x * 5 + y * 7)
	t = t - 1


test_cases = int(input())
for i in range(test_cases):
	cars = list(map(int, input().split()))
	print(cars[0] * 5 + cars[-1] * 7)


l = []
n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	z = x * 5 + y * 7
	l.append(z)
print(*l, sep='\n')


test = int(input())
ans = []
while test:
	test = test - 1
	(N, M) = [int(x) for x in input().split()]
	ans.append(N * 5 + M * 7)
for i in ans:
	print(i)


n = int(input())
for i in range(n):
	(car1, car2) = map(int, input().split(' '))
	total_seats = car1 * 5 + car2 * 7
	print(total_seats)


t = int(input())
for i in range(t):
	l = list(map(int, input().strip().split()))
	print(l[0] * 5 + l[1] * 7)


numOfTc = int(input())
for x in range(numOfTc):
	(fiveSeater, sevenSeater) = [int(x) for x in input().split()]
	print(fiveSeater * 5 + sevenSeater * 7)


travel = int(input())
for v in range(travel):
	(N, M) = map(int, input().split())
	print(5 * N + 7 * M)