import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.io.BufferedInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentSkipListSet; public class Main { public static final int C = 1000000007; static final int CY = 1000000000; //static boolean MAP[][]; static int K; static int B; static int[][] POS; static String S; static int X[][]; static int HA[]; static long DP[]; static int ST[][]; static ConcurrentSkipListSet TS; static ArrayList AL; public static void main(String[] args) { StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); S = sc.next(); BigInteger ans = new BigInteger("1"); int[] a = new int[26]; for (int i=0; i < S.length(); i++) { char c = S.charAt(i); a[c - 'A']++; } ans = msd(S.length()); for (int i=0; i< 26; i++) { ans = ans.divide(msd(a[i])); } System.out.println(ans.add(new BigInteger("-1")).mod(new BigInteger("573"))); } static BigInteger msd(int num) { BigInteger ret = new BigInteger("1"); for (int i=1; i <= num; i++) { ret = ret.multiply(new BigInteger("" + i)); } return ret; } }