#include "bits/stdc++.h" #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define REP(i, n) for(int i = 0; i < int(n); i++) #define FOR(i,n,m) for(int i = int(n); i < int(m); i++) using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = MOD - 1; const ll LLINF = 4e18; template struct mint { private: ll x; public: mint(ll x = 0) :x(x%mod) {} mint(string s) { ll z = 0; REP(i, s.size()) { z *= 10; z += s[i] - '0'; z %= mod; } this->x = z; } mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } friend ostream& operator<<(ostream& os, const mint& n) { return os << n.x; } bool operator==(const mint a) const { return this->x == a.x; } }; int main() { string s; cin >> s; int n = s.size(); mint<573> ans = 1; vector>> comb(n + 1, vector>(n + 1, 0)); REP(i, n + 1) { comb[i][0] = 1; comb[i][i] = 1; } FOR(i, 1, n + 1) { FOR(j, 1, i) { comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j]; } } /* REP(i, n + 1) { REP(j, n + 1) { cout << "comb[" << i << "][" << j << "] = " << comb[i][j] << endl; } } */ vector cnt(26, 0); REP(i, n) { cnt[s[i] - 'A']++; } REP(i, 26) { ans *= comb[n][cnt[i]]; n -= cnt[i]; } cout << ans - 1<< endl; return 0; }