import math def IM(): return map(int, input().split()) def IL()->list[int]: return [int(i) for i in input().split()] MOD = 998244353 S = input() N = len(S) count = [0 for _ in range(10)] for s in S: count[int(s)] += 1 def divmd(a, b): return ((a % MOD) * pow(b, MOD-2, MOD)) % MOD def mod_factorial(n, k = 1, mod=998244353): ret = 1 for i in range(k, n+1): ret *= i ret %= mod return ret ans = 0 NF = mod_factorial(N-1) for i in range(1, 10): if count[i] == 0: continue cnt = NF for j in range(10): if i == j: cnt = divmd(cnt, mod_factorial(count[j]-1, 1, MOD)) else: cnt = divmd(cnt, mod_factorial(count[j], 1, MOD)) ans += cnt ans %= 998244353 print(ans)