#!/c/Python34/python # coding: utf-8 def main(): S = input() ans = 1 a = [0] * 26 for i in range(len(S)): ans *= i+1 a[ord(S[i])-ord('A')] += 1 for i in range(26): while a[i] > 1: ans /= a[i] a[i] -= 1 mod = 573 print((int(ans)-1) % mod) if __name__ == '__main__': main()