*******************************************************************************/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int t,x,y,k;
int main()
{
cin>>t;
for(int i=0;i<t;i++){
cin>>x>>y;
k=0;
int j = x;
while(k<j || k%y != 0){
k++;
}
cout<<k<<endl;
}
return 0;
}