#include int main() { char S[61]; scanf("%s", S); int i, sum = 0, num = 0; for (i = 0; S[i] != 0; i++) { sum += (S[i] - '0') * (i + 1); num += S[i] - '0'; } int j, k, l = i; long long dp[61][2000] = {}; for (i = 1, dp[0][0] = 1; i <= l; i++) { for (j = i - 1; j >= 0; j--) { for (k = 0; k + i < 2000; k++) dp[j+1][k+i] += dp[j][k]; } } printf("%lld\n", dp[num][sum]); fflush(stdout); return 0; }