#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; constexpr i64 MOD = 573; struct Combination { int n; vvi dp; Combination(int n) : n(n) {} void build() { dp = vvi(n + 1, vi(n + 1)); for (int i = 0; i <= n; i++) { dp[i][0] = 1; dp[i][i] = 1; } for (int i = 2; i <= n; i++) { for (int j = 1; j < i; j++) { dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]; dp[i][j] %= MOD; } } } i64 built_ncr(int n, int r) { return dp[n][r]; } // avoid MLE i64 ncr(int n, int r) { if (n < 2) return 1; vi cur(2, 1); for (int i = 2; i <= n; i++) { vi nex(n + 1, 1); for (int j = 1; j < i; j++) { nex[j] = cur[j - 1] + cur[j]; nex[j] %= MOD; } cur = move(nex); } return cur[r]; } }; int main() { string s; cin >> s; Combination comb(1000); comb.build(); map cnt; for (char c: s) { cnt[c]++; } i64 ans = 1; int tot = s.size(); for (auto& p: cnt) { ans *= comb.built_ncr(tot, p.second); ans %= MOD; tot -= p.second; } assert(tot == 0); cout << (ans - 1 + MOD) % MOD << endl; }