import java.io.*; import java.util.*; public class Main { private void run() { String S = read(); HashMap m = new HashMap(); for (int i = 0; i < S.length(); i++) { int now; char c = S.charAt(i); if (m.containsKey(c)) now = m.get(c); else now = 0; m.put(c, now + 1); } int[] mul = new int[S.length() + 1]; for(int i = 2; i <= S.length(); i++) mul[i] = 1; for (Map.Entry entry : m.entrySet()) { int v = entry.getValue(); for(int j = 2; j <= v; ++j) { for(int k = j; k <= S.length(); k += j) { if (mul[k] >= 1) { mul[k]--; mul[k / j]++; break; } } } } int MOD = 573; int ans = 1; for (int i = 2; i <= S.length(); i++) { for (int j = 0; j < mul[i]; j++) { ans *= i; ans %= MOD; } } if (ans == 0) sysout.println(572); else sysout.println(ans - 1); } public static void main(String[] args) { new Main().run(); } // flush automatically iff you call `println` or `printf` or `format`. PrintWriter sysout = new PrintWriter(System.out, true); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer buffer = null; String readLine() { buffer = null; try { return in.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } String read() { if (buffer == null || !buffer.hasMoreTokens()) { buffer = new StringTokenizer(readLine()); } return buffer.nextToken(); } int readInt() { return Integer.parseInt(read()); } long readLong() { return Long.parseLong(read()); } double readDouble() { return Double.parseDouble(read()); } }