1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| const int mod = 998244353; int mypow(int a, int b) { int res = 1; while (b) { if (b & 1) { res *= a; res %= mod; } b >>= 1; a *= a; a %= mod; } return res; }
signed main() { IOS; int n; cin >> n; int len = to_string(n).size(); int b = mypow(10, len); int res = n % mod * (mypow(b, n) - 1) % mod * (mypow(b - 1, mod - 2)) % mod; cout << res << endl;
return 0; }
|