// #undef _GLIBCXX_DEBUG #include using namespace std; #define mod 998244353 #define gcd(a,b) __gcd(a,b) #define lcm(a,b) a/gcd(a,b)*b // no overflow #define bits(x) __builtin_popcountll(x) #define endl "\n" #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); typedef long long int ll; string to_string(const string &s){ return "{" + s + "}"; } string to_string(const char &c){ string s = ""; s += c; return s; } template string to_string(const pair &p){ return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template string to_string(const tuple &t){ return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ")"; } template string to_string(A v){ string res = "{"; bool f = 0; for(const auto &u: v){ if(f){ res += ", "; } f = 1; res += to_string(u); } res += "}"; return res; } void cus_debug() { cerr << "]" << endl; } template void cus_debug(Head H, Tail... T) { cerr << to_string(H) << ", "; cus_debug(T...); } #ifdef _GLIBCXX_DEBUG #define debug(x...) cerr << "[" << #x << "]:[", cus_debug(x) #else #define debug(...) 42 #endif unordered_map mp; ll fac(ll n){ if(n == 0)return 1; // return (n%mod * fac(n-1)%mod)%mod; return ((n) * (fac(n-1))); } ll divv = 1; // start of CP 2.0 void solve(){ string s; cin >> s; ll n = s.size(), zero = 0; for(auto u: s){ if(u == '0'){ zero++; } else{ mp[u-'0']++; } } for(auto u: mp){ if(u.second>1){ divv = divv * fac(u.second); // divv %= mod; } } if(zero){ cout << ((((n-zero)) * fac(n-1))/divv)%mod << endl; } else{ cout << (fac(n)/divv)%mod << endl; } } int main() { IOS; ll t=1; // cin>>t; while(t--){ solve(); } return 0; }