#include <iostream>
using namespace std;
int a[100000] = { 0 };
int rem(int x, int y) {
int r = (x + y) % y;
if (r == 0) {
return x;
}
else {
return x + y - r;
}
}
int main()
{
int t;
int idx = 0;
cin >> t;
for (int i = 0;i < t;i++) {
int x, y;
cin >> x >> y;
int k = rem(x, y);
a[i] = k;
}
for (int i = 0;i < t;i++) {
cout << a[i] << endl;
}
}