You are given $q$ queries in the following form:

Given three integers $l_i$, $r_i$ and $d_i$, find minimum positive integer $x_i$ such that it is divisible by $d_i$ and it does not belong to the segment $[l_i, r_i]$.

Can you answer all the queries?

Recall that a number $x$ belongs to segment $[l, r]$ if $l \le x \le r$.


-----Input-----

The first line contains one integer $q$ ($1 \le q \le 500$) — the number of queries.

Then $q$ lines follow, each containing a query given in the format $l_i$ $r_i$ $d_i$ ($1 \le l_i \le r_i \le 10^9$, $1 \le d_i \le 10^9$). $l_i$, $r_i$ and $d_i$ are integers.


-----Output-----

For each query print one integer: the answer to this query.


-----Example-----
Input
5
2 4 2
5 10 4
3 10 1
1 2 3
4 6 5

Output
6
4
1
3
10

Difficulty: interview

Starter code:

Solutions:
q = int(input())
for _ in range(q):
    l, r, d = list(map(int, input().split()))
    if d < l:
        print(d)
    else:
        v = d * (r // d)
        while v <= r:
            v += d
        print(v)


for _ in range(int(input())):
    l,r,d = list(map(int,input().split()))
    if(l <= d and d <= r):
        x = r-(r%d)
        print(x+d)
    else:
        print(d)


q = int(input())

for qi in range(q):
	li, ri, di = list(map(int, input().split()))

	if di < li:
		print(di)

	else:
		print((ri // di + 1) * di)


for _ in range(int(input())):
   l,r,d=list(map(int, input().split()))
   print(d if d<l else (r//d+1)*d)


q = int(input())
for i in range(q):
    l, r, d = list(map(int, input().split()))
    if d < l:
        print(d)
    else:
        print(r - r % d + d)


q = int(input())
for _ in range(q):
    l, r, d = list(map(int, input().split()))
    if d >= l:
        p = r // d + 1
        print(p * d)
    else:
        print(d)


q=int(input())
for i in range(q):
    l,r,d=list(map(int,input().split()))
    if d<l:
        print(d)
    else:
        print(r//d*d+d)


def ii():
    return int(input())
def mi():
    return list(map(int, input().split()))
def li():
    return list(mi())

for _ in range(ii()):
    l, r, d = mi()
    ans = d
    if l <= d <= r:
        ans = d * (r // d + 1)
    print(ans)


q=int(input())
for i in range(q):
    l,r,d=list(map(int,input().split()))
    if d<l:
        print(d)
    else:
        print(d*(r//d+1))


q = int(input())
for i in range(q):
    a, b, d = map(int, input().split())
    if d < a:
        print(d)
    else:
        print(b // d * d + d)

q = int(input())
for i in range(q):
	l, r, d = list(map(int, input().split()))
	if l > d:
		print(d)
	else:
		print(r // d * d + d)


q = int(input())

for _ in range(q):
    l, r, d = map(int, input().split())
    if d < l:
        print(d)
    else:
        print((r // d + 1) * d)

n = int(input())
for i in range(n):
    a, b, c = [int(i) for i in input().split()]
    if a<=c <=b:
        print((b//c+1)*c)
    else:
        print(c)


t = int(input())
for i in range(t):
	l,r,d = list(map(int, input().split()))
	if d<l:
		print(d)
	elif d>r:
		print(d)
	else:
		print(((r)//d+1)*d)


from sys import stdin
n=int(stdin.readline().strip())
for i in range(n):
    s=list(map(int,stdin.readline().strip().split()))
    if s[0]>s[2]:
        print(s[2])
        continue
    x=s[1]//s[2]
    x+=1
    print(x*s[2])


q = int(input())
for i in range(q):
	lrd = input().split()
	for j in range(3):
		lrd[j] = int(lrd[j])
	l = lrd[0]
	r = lrd[1]
	d = lrd[2]
	if d < l:
		print(d)
	else:
		print(d * (r // d + 1))

def main():
    q = int(input())
    
    for i in range(q):
        l, r, d = map(int, input().split())
        
        if d < l:
            print(d)
        else:
            print(r - r % d + d)

main()

def mi():
    return list(map(int, input().split()))
'''
5
2 4 2
5 10 4
3 10 1
1 2 3
4 6 5
'''

for _ in range(int(input())):
    l,r,d = mi()
    nl=d
    nr=r-r%d
    nr+=d

    if nl<l:
        print (nl)
    else:
        print (nr)


q = int(input())

for c in range(q):
    l, r, d = map(int, input().split())
    if l > d:
        print(d)
    else:
        print(r + (d - (r % d)))

for _ in range(int(input())):
	l,r,d=list(map(int,input().split()))
	if d<l:
		print(d)
	else:
		k = r//d
		print((k+1)*d)


for i in range(int(input())) :
    l,r,d = map(int,input().split())
    if l > d:
        print(d)
    else :
        j=r-r%d+d
        print(j)

q = int(input())
for i in range(q):
    l, r, d = list(map(int, input().split()))
    if d < l:
        print(d)
    else:
        print(((r // d) + 1) * d)


n=int(input())
for i in range(n):
    a,b,c=list(map(int,input().split()))
    if(a>c):
        print(c)
    else:
        print(((b+c)//c)*c)


for i in range(int(input())):
    l,r,d=map(int,input().split())
    if d<l:
        print(d)
    else:
        k=(r+d-1)//d
        ans=k*d
        if ans==r:
            ans+=d
        print(ans)