from collections import defaultdict def prime_factorize(n): dic0 = defaultdict(int) while n % 2 == 0: dic0[2] += 1 n //= 2 f = 3 while f * f <= n: if n % f == 0: dic0[f] += 1 n //= f else: f += 2 if n != 1: dic0[n] += 1 return dic0 S = input() N = len(S) dic2 = defaultdict(int) for i in range(2, N + 1): for k, v in prime_factorize(i).items(): dic2[k] += v dic = defaultdict(int) for s in S: dic[s] += 1 for v0 in dic.values(): for k, v in prime_factorize(v0): dic2[k] -= v ans = 1 for k, v in dic2.items(): ans *= pow(k,v,573) ans %= 573 print(ans - 1)