#include <iostream>
using namespace std;
void solve(){
int x,y;
cin>>x>>y;
for(int i=x+1;;i++){
if(i%y==0){
cout<<i<<endl;
return ;
}
}
}
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}