#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define el endl
#define all(v) v.begin(),v.end()
#define t int t;cin>>t; while(t--)
#define out(a,n) for(int i=0;i<n;i++){cout<<a[i]<< " ";}
#define FAST ios_base::sync_with_stdio(false), cin.tie(NULL);
using namespace std;
using pll = pair<ll, ll>;
int main ()
{
FAST;
t
{
ll n,m;
cin>>n>>m;
cout<<(m*(n/m))/m;
}
}