#include #include using namespace std; using mint = atcoder::modint998244353; mint fact[2<<17], ifac[2<<17]; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); fact[0] = ifac[0] = 1; for(int i = 1; i < 2<<17;i++) { fact[i] = fact[i - 1] * i; ifac[i] = fact[i].inv(); } string S; cin >> S; const int N = S.size(); vector freq(10); for(int i = 0; i < N; i++) freq[S[i] - '0'] += 1; mint ans = 0; for(int i = 1; i < 10; i++) if(freq[i]) { mint t = fact[N-1]; for(int j = 0; j < 10; j++) t *= ifac[freq[j] - (j == i)]; ans += t; } cout << ans.val() << "\n"; }