/* -*- coding: utf-8 -*- * * 1620.cc: No.1620 Substring Sum - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; const int MOD = 998244353; /* typedef */ typedef long long ll; /* global variables */ char s[MAX_N + 4]; int e2s[MAX_N + 1], e11s[MAX_N + 1]; /* subroutines */ /* main */ int main() { scanf("%s", s); int n = strlen(s); e2s[0] = e11s[0] = 1; for (int i = 0; i < n; i++) { e2s[i + 1] = (ll)e2s[i] * 2 % MOD; e11s[i + 1] = (ll)e11s[i] * 11 % MOD; } int sum = 0; for (int i = 0; i < n; i++) { int d = s[i] - '0'; sum = (sum + (ll)d * e2s[i] % MOD * e11s[n - 1 - i] % MOD) % MOD; } printf("%d\n", sum); return 0; }