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