#include #define ll long long #define INF 1000000005 #define MOD 573 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)n;++i) #define each(a, b) for(auto (a): (b)) #define all(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define show(x) cout <<#x<<" = "<<(x)<P; const int MAX_N = 1001; ll comb[MAX_N][MAX_N]; void make(int N){ rep(i,N+1){ comb[i][0] = 1; } for(int i=1;i<=N;i++){ for(int j=1;j<=i;j++){ comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % MOD; } } } int cnt[26]; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; rep(i,s.length()){ cnt[s[i] - 'A']++; } make((int)s.length()); ll ans = 1; int rem = (int)s.length(); rep(i,26){ ans = ans * comb[rem][cnt[i]] % MOD; rem -= cnt[i]; } cout << ans-1 << endl; return 0; }