#include using namespace std; #include using namespace atcoder; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { int T; cin >> T; ll MOD = 998244353; rep(i, T) { ll n, m, ans; cin >> n >> m; n %= m * 2; if(n > m) { ans = (pow_mod(10, 2 * m - n, MOD) - 1 + MOD) % MOD; ans *= pow_mod(10, n - m, MOD); ans %= MOD; } else { ans = (pow_mod(10, n, MOD) - 1 + MOD) % MOD; } cout << ans << endl; } }