import math from collections import Counter s = Counter(input()) li = list(s.values()) N = sum(li) mod = 573 C = [ [0] * (N + 1) for i in range(N + 1) ] for i in range(N + 1): C[i][0] = 1 for j in range(1, i + 1): C[i][j] = C[i - 1][j] + C[i - 1][j - 1] if C[i][j] >= mod: C[i][j] -= mod ans = 1 rem = N for x in li: ans = ans * C[rem][x] % mod rem -= x print(ans - 1)