Chef is eagerly waiting for a piece of information. His secret agent told him that this information would be revealed to him after K weeks.

X days have already passed and Chef is getting restless now. Find the number of remaining days Chef has to wait for, to get the information.

It is guaranteed that the information has not been revealed to the Chef yet. 

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

- The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
- The first and only line of each test case contains two space-separated integers K and X, as described in the problem statement. 

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

For each test case, output the number of remaining days that Chef will have to wait for. 

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

$1 ≤ T ≤ 500$
$1 ≤ K ≤ 10$
$1 ≤ X < 7\cdot K$ 

----- Sample Input 1 ------ 
4
1 5
1 6
1 1
1 2
----- Sample Output 1 ------ 
2
1
6
5

----- explanation 1 ------ 
Test case $1$: The information will be revealed to the Chef after $1$ week, which is equivalent to $7$ days. Chef has already waited for $5$ days, so he needs to wait for $2$ more days in order to get the information.

Test case $2$: The information will be revealed to the Chef after $1$ week, which is equivalent to $7$ days. Chef has already waited for $6$ days, so he needs to wait for $1$ more day in order to get the information. 

Test case $3$: The information will be revealed to the Chef after $1$ week, which is equivalent to $7$ days. Chef has already waited for $1$ day, so he needs to wait for $6$ more days in order to get the information. 

Test case $4$: The information will be revealed to the Chef after $1$ week, which is equivalent to $7$ days. Chef has already waited for $2$ days, so he needs to wait for $5$ more days in order to get the information.

Source: codechef | Difficulty: EASY
Tags: Mathematics


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


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


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


t = int(input())
for _ in range(t):
	(a, b) = input().split()
	print(int(a) * 7 - int(b))


t = int(input())
for u in range(t):
	(K, X) = list(map(int, input().split()))
	print(K * 7 - X)


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


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


for t in range(int(input())):
	(i, j) = map(int, input().split(' '))
	print(7 * i - j)


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


for _ in range(int(input())):
	(k, x) = map(int, input().split())
	print(k * 7 - x)


T = int(input())
for i in range(T):
	(K, X) = map(int, input().split())
	print(K * 7 - X)


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


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


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


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	p = a * 7
	print(p - b)


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


t = int(input())
for i in range(t):
	(K, X) = map(int, input().split())
	days = K * 7
	wait = days - X
	print(wait)


p = int(input())
for _ in range(p):
	(s, z) = map(int, input().split())
	days_left = 7 * s - z
	print(days_left)


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


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


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


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


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


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


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


T = int(input())
for i in range(T):
	(k, x) = map(int, input().split())
	days = x
	weeks = k
	num_days_in_week = 7 * k
	wait = num_days_in_week - days
	print(wait)


t = int(input())
for i in range(t):
	(k, x) = map(int, input().split())
	if k >= 1 and x >= 1:
		print(k * 7 - x)


T = int(input())
for t in range(T):
	(K, X) = map(int, input().split())
	q = K * 7
	w = q - X
	print(w)


T = int(input())
for i in range(0, T):
	(K, X) = input().split()
	k = int(K)
	x = int(X)
	c = 7 * k
	print(c - x)


t = int(input())
for ts in range(t):
	(x, y) = map(int, input().split(' '))
	print(7 * x - y)


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


cases = int(input())
for case in range(cases):
	(x, y) = map(int, input().split())
	print(x * 7 - y)


T = int(input())
for CRICKETER in range(T):
	(K, X) = map(int, input().split())
	if (K, X):
		X = 7 * K - X
		print(X)