from collections import Counter mod = 573 class PascalsTriangle: def __init__(self, N, mod): self.N = N self.mod = mod self._build() def __call__(self, n, r): if n > self.N: raise "INVALID INPUT: input n must be smaller than N" if r < 0 or r > self.N: return 0 return self.nCr[n][r] def _build(self): tmp = [(1,)] P = self.mod for i in range(1, self.N + 1): nCi = tuple(1 if j in (0, i) else (tmp[-1][j-1] + tmp[-1][j]) % P for j in range(i+1)) tmp.append(nCi) self.nCr = tuple(tmp) def main(): S = input() C = Counter(S) pc = PascalsTriangle(1000, mod) N = len(S) ans = 1 for v in C.values(): ans *= pc(N, v) ans %= mod N -= v ans = (ans + mod - 1) % mod return ans print(main())