You are given three numbers $a$, $b$, $c$ . Write a program to determine the largest number that is less than or equal to $c$ and leaves a remainder $b$ when divided by $a$.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow.
- Each testcase contains a single line of input, having three integers $a$, $b$, $c$.

-----Output:-----
- For each testcase, output in a single line the largest number less than or equal to $c$.

-----Constraints:-----
- $1 \leq T  \leq 100000$
- $0 \leq b < a < c \leq$ $10$^18

-----Sample Input:-----
1
7 2 10

-----Sample Output:-----
9

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	p = c // a * a + b
	if p <= c:
		print(p)
	else:
		print((c // a - 1) * a + b)


try:
	for _ in range(int(input())):
		(a, b, c) = [int(i) for i in input().split()]
		r = c % a
		if r > b:
			print(c - (r - b))
		elif r < b:
			print(c - r - a + b)
		else:
			print(c)
except EOFError as e:
	pass


n = int(input())
while n:
	(a, b, c) = list(map(int, input().split()))
	m = c // a
	m = m * a + b
	if m > c:
		m -= a
	print(m)
	n -= 1


t = int(input())
for _ in range(t):
	(a, b, c) = list(map(int, input().split()))
	print((c - b) // a * a + b)


try:
	t = int(input())
	for i in range(t):
		(a, b, c) = map(int, input().split())
		x = c // a
		ans = x * a + b
		if ans > c:
			ans = ans - a
		print(ans)
except:
	pass


n = int(input())
for i in range(n):
	abc = list(map(int, input().split()))
	a = abc[0]
	b = abc[1]
	c = abc[2]
	l = c - c % a
	if l + b > c:
		l = l - a
	if a <= b:
		l = 0
	print(l + b)


for t in range(int(input())):
	(a, b, c) = [int(i) for i in input().split(' ')]
	r = c % a
	ans = c - r + b
	if ans > c:
		ans -= a
	print(ans)


x = int(input())
for i in range(x):
	(a, b, c) = list(map(int, input().split()))
	for j in range(c // a, -1, -1):
		if a * j + b <= c:
			print(a * j + b)
			break


T = int(input())
for i in range(T):
	(a, b, c) = map(int, input().split())
	rem = c % a
	k = c - rem + b
	while k > c:
		k = k - a
	print(k)


for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	i = 0
	d = 0
	while d <= c:
		d = a * i + b
		i = i + 1
	print(d - a)


t = int(input())
for _ in range(t):
	(a, b, c) = input().split()
	(a, b, c) = (int(a), int(b), int(c))
	d = c - c % a + b
	if d > c:
		print(d - a)
	else:
		print(d)


def solve(a, b, c):
	n = b
	while n <= c:
		n += a
	return n - a
ans = []
T = int(input())
for i in range(T):
	li = [int(x) for x in input().strip().split()]
	ans.append(solve(li[0], li[1], li[2]))
for ele in ans:
	print(ele)


a = int(input())
for i in range(a):
	l = list(map(int, input().split()))
	for i in range((l[2] - l[1]) // l[0] + 1):
		x = i * l[0] + l[1]
		while x >= l[2]:
			break
	print(x)


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


t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	c = l[2]
	x = c // a
	while 1:
		if a * x + b <= c:
			print(a * x + b)
			break
		else:
			x = x - 1


T = int(input())
while T:
	(a, b, c) = map(int, input().split())
	d = c % a
	if d < b:
		i = c - d - a + b
	else:
		i = c - d + b
	print(i)
	T -= 1


t = int(input())
for i in range(0, t):
	a = input().split()
	b = list(map(int, a))
	n = int(b[2] / b[0])
	if b[0] * n + b[1] <= b[2]:
		print(b[0] * n + b[1])
	else:
		print(b[0] * (n - 1) + b[1])


t = int(input())
while t:
	(a, b, c) = [int(i) for i in input().split(' ')]
	k = (c - b) // a
	print(k * a + b)
	t -= 1


t = int(input())
for i in range(t):
	lst = input().split()
	for j in range(3):
		lst[j] = int(lst[j])
	if lst[2] % lst[0] == lst[1]:
		print(lst[2])
	elif lst[2] % lst[0] < lst[1]:
		print(lst[2] - (lst[0] - lst[1] + lst[2] % lst[0]))
	else:
		print(lst[2] - (lst[2] % lst[0] - lst[1]))


t = 0
try:
	t = int(input())
except:
	pass
for _ in range(t):
	(a, b, c) = map(int, input().split())
	d = c % a
	if d < b:
		print(c - d + b - a)
	else:
		print(c - d + b)


n = int(input())
for i in range(n):
	l = list(map(int, input().split(' ')))
	p = 0
	k = 0
	while p <= l[2]:
		m = p
		p = l[0] * k + l[1]
		k += 1
	print(m)