#include <iostream>
using namespace std;
const int N = 1e5 + 5;
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;
}
}
return 0;
}