#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 R=N%M; cout << (modpow(10,R)-1+MOD)%MOD << endl; } return 0; }