There are 100 questions in a paper. Each question carries +3 marks for correct answer, -1 marks for incorrect answer and 0 marks for unattempted question.

It is given that Chef received exactly X (0 ≤ X ≤ 100) marks. Determine the minimum number of problems Chef marked incorrect.

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

- First line will contain T, number of test cases. Then the test cases follow.
- Each testcase contains of a single integer X, marks that Chef received.

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

For each test case, output the minimum number of problems Chef marked incorrect.

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

$1 ≤ T ≤ 100$
$0 ≤ X ≤ 100$

----- Sample Input 1 ------ 
4
0
100
32
18

----- Sample Output 1 ------ 
0
2
1
0

----- explanation 1 ------ 
Test Case $1$: It might be possible that Chef didn't attempt any question in which case he didn't get any question incorrect.

Test Case $2$: For the case when Chef got $34$ questions correct and $2$ questions incorrect, Chef marked minimum incorrect questions.

Test Case $3$: For the case when Chef got $11$ questions correct and $1$ question incorrect, Chef marked minimum incorrect questions.

Test Case $4$: For the case when Chef got $6$ questions correct and no question incorrect, Chef marked minimum incorrect questions.

Source: codechef | Difficulty: EASY


Solutions:
import math as m
n = int(input())
for i in range(n):
	p = int(input())
	if p % 3 == 0:
		i = 0
		print(i)
	else:
		b = m.ceil(p / 3)
		a = b * 3
		print(a - p)


for t in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print('0')
	elif n % 3 == 1:
		print('2')
	else:
		print('1')


for i in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(0)
	elif n % 3 == 1:
		print(2)
	elif n % 3 == 2:
		print(1)


for i in range(int(input())):
	n = int(input()) % 3
	print(3 - n if n else 0)


import math
t = int(input())
for i in range(t):
	x = int(input())
	if x == 0 or x % 3 == 0:
		print(0)
	else:
		a = math.ceil(x / 3)
		k = a * 3 - x
		print(k)


T = int(input())
for i in range(T):
	X = int(input())
	r = X % 3
	if r == 0:
		print(0)
	elif r == 1:
		print(2)
	else:
		print(1)


import math
for _ in range(int(input(' '))):
	n = int(input())
	x = math.ceil(n / 3)
	y = x * 3
	print(y - n)


import math
for i in range(int(input())):
	x = int(input())
	n = math.ceil(x / 3)
	a = n * 3
	print(a - x)


t = int(input())
for i in range(t):
	x = int(input())
	a = x % 3
	if a == 0:
		print('0')
	else:
		print(3 - a % 3)


t = int(input())
while t:
	x = int(input())
	print(0 if x % 3 == 0 else 3 - x % 3)
	t -= 1


for _ in range(int(input())):
	x = int(input())
	if x % 3 == 0:
		print(0)
	else:
		print(3 - x % 3)


n = int(input())
for i in range(n):
	x = int(input())
	if x % 3 == 0:
		print(0)
	else:
		ca = x // 3 + 1
		a = ca * 3
		print(a - x)


for i in range(int(input())):
	a = int(input())
	c = int(a / 3) if a % 3 == 0 else int(a / 3) + 1
	print(3 * c - a)


t = int(input())
for _ in range(t):
	pts = int(input())
	print(3 - pts % 3 if pts % 3 != 0 else 0)


for i in range(int(input())):
	X = int(input())
	corAns = int(X / 3) if X % 3 == 0 else int(X / 3) + 1
	print(3 * corAns - X)


import math
t = int(input())
while t > 0:
	x = int(input())
	print(abs(x - math.ceil(x / 3) * 3))
	t -= 1


import math
n = int(input())
for i in range(n):
	a = int(input())
	x = math.ceil(a / 3)
	if x * 3 >= a:
		print(x * 3 - a)
	else:
		print('0')


for i in range(int(input())):
	x = int(input())
	if x == 0:
		print(0)
	else:
		print((x + 2) // 3 * 3 - x)


for i in range(int(input())):
	m = int(input())
	if m % 3 == 0:
		a = m % 3
	else:
		a = 3 - m % 3
	print(int(a))


t = int(input())
for i in range(t):
	x = int(input())
	a = (x + 2) // 3
	b = a * 3
	print(b - x)


n = int(input())
for i in range(n):
	a = int(input())
	b = 0
	if a % 3 == 0:
		print('0')
	else:
		while a % 3 != 0:
			a = a + 1
			b = b + 1
		print(b)


T = int(input())
for i in range(0, T):
	x = int(input())
	if x % 3 == 0:
		print(0)
	elif x % 3 == 1:
		print(2)
	else:
		print(1)


a = int(input())
for i in range(a):
	b = int(input())
	if b % 3 == 1:
		print('2')
	elif b % 3 == 2:
		print('1')
	else:
		print('0')


n = int(input())
for i in range(n):
	a = int(input())
	x = a // 3
	y = x * 3 + 3
	if a % 3 == 0:
		print(0)
	else:
		print(y - a)


t = int(input())
for i in range(t):
	x = int(input())
	k = x // 3
	if k == x:
		print(0)
	elif k * 3 < x:
		r = k + 1
		n = r * 3
		c = 0
		while n > x:
			c = c + 1
			n = n - 1
		print(c)
	else:
		print(0)


import math
for i in range(int(input())):
	a = int(input())
	b = math.ceil(a / 3) * 3
	print(b - a)


t = int(input())
for i in range(t):
	X = int(input())
	if X % 3 == 0:
		print(0)
	elif X % 3 == 1:
		print(2)
	elif X % 3 == 2:
		print(1)


for i in range(int(input())):
	x = int(input())
	if x == 0:
		print(0)
	elif x % 3 == 0:
		print(0)
	else:
		c = x // 3 + 1
		v = c * 3 - x
		print(v)


for i in range(int(input())):
	num = int(input())
	print((num + num % 3) % 3)


t = int(input())
for tc in range(t):
	x = int(input())
	r = x % 3
	if r == 0:
		print(r)
	else:
		print(3 - r)


T = int(input())
for i in range(T):
	x = int(input())
	if x % 3 == 0:
		print(0)
	else:
		rem = x % 3
		inc = 3 - rem
		print(inc)


from math import ceil
temp = 0
for i in range(int(input())):
	b = int(input())
	temp = b
	if b % 3 == 0:
		print('0')
	else:
		temp /= 3
		temp = ceil(temp)
		temp *= 3
		temp -= b
		print(temp)


import math
t = int(input())
for i in range(t):
	x = int(input())
	k = x % 3
	if k % 3 == 0:
		print(k % 3)
	else:
		print(3 - k % 3)


t = int(input())
c = 0
for i in range(t):
	x = int(input())
	if x % 3 == 0:
		print(0)
	if (x + 1) % 3 == 0:
		print(1)
	if (x + 2) % 3 == 0:
		print(2)


import math
for t in range(int(input())):
	m = int(input())
	questions = math.ceil(m / 3)
	incorrect_questions = questions * 3 - m
	print(incorrect_questions)


t = int(input())
for i in range(t):
	x = int(input())
	if x == 0 or x % 3 == 0:
		print(0)
	else:
		y = (x // 3 + 1) * 3 - x
		print(y)


t = int(input())
for i in range(t):
	x = int(input())
	incorrect = 0
	if x % 3 == 0:
		incorrect = 0
	elif x % 3 != 0:
		incorrect = 3 - x % 3
	print(incorrect)


t = int(input())
for i in range(t):
	x = int(input())
	k = x % 3
	if k == 1:
		print(2)
	elif k == 2:
		print(1)
	else:
		print(0)


def solve():
	x = int(input())
	if x % 3 == 0:
		print(0)
		return
	print(3 - x % 3)
for _ in range(int(input())):
	solve()


import math
for _ in range(int(input())):
	x = int(input())
	p = math.ceil(x / 3)
	print(p * 3 - x)


n = int(input())
for i in range(n):
	k = int(input())
	if k % 3:
		m = (k // 3 + 1) * 3
		print(m - k)
	else:
		m = k // 3 * 3
		print(m - k)


test_case = int(input())
for i in range(0, test_case):
	X = int(input())
	if X % 3 == 0:
		print(0)
	else:
		print(3 - X % 3)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 3 == 0:
		print(0)
	else:
		d = n // 3 + 1
		print(d * 3 - n)


t = int(input())
for i in range(t):
	x = int(input())
	if x % 3 == 0:
		print(0)
	else:
		for i in range(1, 100):
			if (x + i) % 3 == 0:
				print(i)
				break


for _ in range(int(input())):
	x = int(input())
	s = x / 3
	s1 = x // 3
	temp = 0
	if s > s1:
		temp = temp + s1 + 1
	else:
		temp += s1
	dump = temp * 3
	final = dump - x
	print(final)


n = int(input())
for i in range(n):
	x = int(input())
	if x % 3 != 0:
		a = x // 3 + 1
		b = 3 * a
		c = x - b
		print(-c)
	else:
		print('0')


T = int(input())
for i in range(T):
	x = int(input())
	k = x % 3
	if k % 3 == 0:
		print(k % 3)
	else:
		print(3 - k % 3)


import math
n = int(input())
for i in range(n):
	a = int(input())
	if a == 0:
		print(0)
	else:
		b = math.ceil(a / 3)
		c = b * 3 - a
		print(c)


TC = int(input())
for T in range(TC):
	X = int(input())
	if X % 3 == 0:
		print(0)
	else:
		print(3 - X % 3)


T = int(input())
for i in range(T):
	X = int(input())
	if X % 3 == 0:
		print('0')
	else:
		rem = X % 3
		res = 3 - rem
		print(res)