#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; if(N<=M){ cout << (modpow(10,N)+MOD-1)%MOD << endl; }else{ ll x=(N-M)/M; x++; if(x%2==0){ cout << (modpow(10,N-x*M)+MOD-1)%MOD << endl; }else{ cout << (-modpow(10,N-x*M)+2*MOD-1)%MOD << endl; } } } return 0; }