A. Minimum Integer

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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*≤*x*≤*r*

.

Input

The first line contains one integer *q*

(1≤*q*≤500) — the number of queries.

Then *q*

lines follow, each containing a query given in the format *li* *r**i* *d**i* (1≤*l**i*≤*r**i*≤109, 1≤*d**i*≤109). *l**i*, *r**i* and *d**i*

are integers.

Output

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

```
<strong>CODE:</strong>
n=int(input())
prob=list()
for i in range(n):
x=list(map(int,input().split()))
prob.append(x)
for i in range(n):
l,r,d=prob[i][0],prob[i][1],prob[i][2]
for j in range(1,1000000000):
if j>=l and j<=r:
continue
elif (j%d)==0 and j!=0:
print(j)
break
```

The above code should run <=1 sec.