#include <iostream>
using namespace std;
//int N = 10e5+1;
int main(){
int t;
cin >> t;
long long x, y;
while(t){
cin >> x >> y;
if(x <= y) {
cout << y << endl;
}
else {
cout<<x+(y-(x%y))<<endl;
}
t--;
}
}