import java.util.*; import java.math.*; public class Main { static final int MOD = 573; public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); int n = arr.length; int[][] comb = new int[n + 1][n + 1]; for (int i = 0; i <= n; i++) { for (int j = 0; j <= i; j++) { if (j == 0 || j == i) { comb[i][j] = 1; } else { comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % MOD; } } } int[] counts = new int[26]; for (char c : arr) { counts[c - 'A']++; } int ans = 1; for (int x : counts) { ans *= comb[n][x]; ans %= MOD; n -= x; } ans = (ans - 1 + MOD) % MOD; System.out.println(ans); } }