#include<string>
#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
int x, y,num=0;
while (t--) {
cin >> x >> y;
num = x;
while (num % y != 0)
{
num = num + 1;
}
cout << num << endl;
}
}