#include using namespace std; typedef long long ll; typedef pair P; #define REP(i,n) for(int i=0;i> T; while(T--){ ll M,N; cin >> N >> M; ll x=N%(2*M); ll a=(modpow(10,x)-1+MOD)%MOD; ll b=(2*MOD-modpow(10,x-M)-1)%MOD; if(x