#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; #define MOD 573 vector factorize(int x){ vector ret; int d, q; while(x>=4 && x%2==0){ret.push_back(2); x/=2;} d = 3; q = x/d; while(q>=d){ if(x%d==0){ ret.push_back(d); x=q; }else{ d+=2; } q=x/d; } ret.push_back(x); return ret; } int main(){ ios::sync_with_stdio(false); string S; cin >> S; map cnt; rep(i,S.length()){ cnt[S[i]]++; } vector v; FOR(it,cnt){ v.push_back(it->second); } map elem; vector fact; REP(i,1,S.length()+1){ fact = factorize(i); rep(j,fact.size()){ elem[fact[j]]++; } } rep(i,v.size()){ REP(j,1,v[i]+1){ fact = factorize(j); rep(k,fact.size()){ elem[fact[k]]--; } } } int ret = 1; FOR(it,elem){ if(it->first == 1) continue; rep(i,it->second){ ret *= it->first; ret %= MOD; } } cout << ret-1 << endl; return 0; }