import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines s=readline().rstrip().decode() n=len(s) MOD=573 f=[1]*(n+1) for i in range(1, n+1): f[i]=f[i-1]*i from collections import Counter c=Counter(s) ans=f[n] for y in c.values(): ans//=f[y] print((ans-1)%MOD)