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