#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
constexpr int MOD = 998244353;
int main() {
string S; cin >> S;
int N = S.size();
vector<ll> W(N, 1), V(N);
for (int i = 0; i < N; ++i) V[i] = S[i] - '0';
for (int i = N-2; i >= 0; --i) W[i] = 10 * W[i+1] % MOD;
ll ans = 0;
for (int a = 0; a < N; ++a) {
for (int b = a+1; b < N; ++b) {
for (int c = b+1; c < N; ++c) {
if (a == 0 && S[c] == '0') continue;
swap(V[c],V[b]);
swap(V[a],V[b]);
for (int i = 0; i < N; ++i) ans += W[i] * V[i];
ans %= MOD;
swap(V[a],V[b]);
swap(V[c],V[b]);
}
}
}
cout << (ans%MOD+MOD)%MOD << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CmNvbnN0ZXhwciBpbnQgTU9EID0gOTk4MjQ0MzUzOyAKaW50IG1haW4oKSB7CglzdHJpbmcgUzsgY2luID4+IFM7CglpbnQgTiA9IFMuc2l6ZSgpOwoJdmVjdG9yPGxsPiBXKE4sIDEpLCBWKE4pOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBOOyArK2kpIFZbaV0gPSBTW2ldIC0gJzAnOwoJZm9yIChpbnQgaSA9IE4tMjsgaSA+PSAwOyAtLWkpIFdbaV0gPSAxMCAqIFdbaSsxXSAlIE1PRDsKCWxsIGFucyA9IDA7Cglmb3IgKGludCBhID0gMDsgYSA8IE47ICsrYSkgewoJCWZvciAoaW50IGIgPSBhKzE7IGIgPCBOOyArK2IpIHsKCQkJZm9yIChpbnQgYyA9IGIrMTsgYyA8IE47ICsrYykgewoJCQkJaWYgKGEgPT0gMCAmJiBTW2NdID09ICcwJykgY29udGludWU7CgkJCQlzd2FwKFZbY10sVltiXSk7CgkJCQlzd2FwKFZbYV0sVltiXSk7CgkJCQlmb3IgKGludCBpID0gMDsgaSA8IE47ICsraSkgYW5zICs9IFdbaV0gKiBWW2ldOwoJCQkJYW5zICU9IE1PRDsKCQkJCXN3YXAoVlthXSxWW2JdKTsKCQkJCXN3YXAoVltjXSxWW2JdKTsKCQkJfQoJCX0KCX0gCgljb3V0IDw8IChhbnMlTU9EK01PRCklTU9EIDw8IGVuZGw7IAp9Cg==
MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTA=
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890