#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
int arr[t];
for (int j=0;j<t;j++){
int x,y;
cin>>x>>y;
if(x%y==0 && x<=y){
cout<<y<<endl;
}
else if (x%y==0){
cout<<x<<endl;
}
else {
int k = x+1;
while(1){
if (k%y==0){ cout<<k<<endl; break;}
k++;
}
}
}
//for (int i=0;i<t;i++) cout <<arr[i]<<endl;
return 0;
}