import java.util.*; public class Main_yukicoder171 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); int n = s.length; int[] a = new int[26]; for (char c : s) { a[c - 'A']++; } preCombi(n); int ret = 1; for (int e : a) { // System.out.printf("%d %d\n", n, e); ret = (int)(ret * combination(n, e) % MOD); n -= e; } System.out.println((ret - 1 + MOD) % MOD); sc.close(); } private static int MOD = 573; private static long[][] cache; private static void preCombi(int size) { cache = new long[size + 1][]; for (int i = 0; i <= size; i++) { cache[i] = new long[i + 1]; for (int j = 0; j <= i; j++) { if (j == 0 || j == i) { cache[i][j] = 1; } else { cache[i][j] = (cache[i - 1][j] + cache[i - 1][j - 1]) % MOD; } } } } private static long combination(int n, int r) { r = Math.min(n - r, r); if (r < 0) { return 0; } return cache[n][r]; } }