import java.util.Scanner; public class main { public static final void main(String[] args) { new main(); } public main() { Scanner sc = new Scanner(System.in); String s = sc.next(); System.out.println(solve(s)); } int[][] dp; private int solve(String s) { dp = new int[1001][1001]; for(int i=0;i<1001;i++){ dp[i][0] = 1; for(int j=1;j<=i;j++) dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % 573; } int[] count = new int[26]; for(char c : s.toCharArray()) count[c-'A']++; int res = 1; int ct = s.length(); for(int c : count){ res = (res*dp[ct][c])%573; ct -= c; } res = (res+573-1)%573; return res; } }