#include"bits/stdc++.h" //#include using namespace std; #define print(x) cout<> s; ll count[26] = {}; ll n= s.size(); ll c[1005][1005] = {}; rep(i, 1, 1002) { rep(j, 0, i+1) { c[i][j] = (j == 0 || j == 1) ? 1 : (c[i - 1][j - 1] + c[i - 1][j]) % mod; } } rep(i, 0, n) { count[s[i] - 'A']++; } ll ret = 1; rep(i, 0, 26) { if (count[i] > 1) { ret = ret*c[n][count[i]] % mod; n -= count[i]; } } if (ret == 0) { print(0); } else print(ret - 1); return 0; }