import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import Counter S = read().rstrip() fact = [1] * 1001 for n in range(1,1001): fact[n] = fact[n-1] * n MOD = 573 x = fact[len(S)] for v in Counter(S).values(): x //= fact[v] answer = (x - 1) % MOD print(answer)