#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
for(int i=0; i<n; i++){
int x,y;
cin>>x>>y;
if(x<=y) cout<<y<<endl;
else{
if(x%y!=0)
cout<<x+(y-(x%y))<<endl;
else cout <<x<<endl;
}
}
return 0;
}