#include<bits/stdc++.h>usingnamespace std;using LL =longlong;constint mod =998244353;
LL Pow(LL n,int k){
LL res =1;while(k){if(k &1) res *= n;
k >>=1;
n *= n;}return res;}voidsolve(LL n){
string s =to_string(n);int len = s.size();
LL res =0;for(int i =1; i <= len -1; i ++){
LL ed =9*Pow(10, i -1);
res =(LL)(res +(LL)(1+ ed)% mod *(ed % mod)/2)% mod;}
LL x =Pow(10, len -1);
LL ed = n - x +1;
res =(LL)(res +(LL)(1+ ed)% mod *(ed % mod)/2)% mod;
cout << res <<'\n';return;}intmain(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
LL n;
cin >> n;solve(n);return0;}