You are given q queries in the following form:
Given three integers li, ri and di, find minimum positive integer xi such that it is divisible by di and it does not belong to the segment [li,ri].
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 ri di (1≤li≤ri≤109, 1≤di≤109). li, ri and di 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
#include<bits/stdc++.h>
using namespace std;
void solve()
{
long long l,r,d,x=0,tmp;
cin>>l>>r>>d;
if(l>d)x=d;
else x=((r/d)+1)*d;
cout<<x<<endl;
}
int main()
{
int q;
cin>>q;
while(q--)solve();
return 0;
}