#include using namespace std; using LL = long long; const int N = 60 + 7; int n, c, m; LL f[N][N * N]; char s[N]; int main() { scanf("%s", s + 1); n = strlen(s + 1); for(int i = 1; s[i]; ++i) { c += s[i] - '0'; m += i * (s[i] - '0'); } f[0][0] = 1; for(int i = 1; i <= c; ++i) for(int j = i; j <= m; ++j) { f[i][j] = f[i][j - i] + f[i - 1][j - i]; if(j > n) f[i][j] -= f[i - 1][j - n - 1]; } printf("%lld\n", f[c][m]); return 0; }