fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let s = s.trim().chars().collect::>(); let n = s.len(); let score = s.iter().enumerate().filter(|&(_, &c)| c == '1').map(|(i, _)| i+1).sum::(); let one_cnt = s.iter().filter(|&&c| c == '1').count(); let mut dp = vec![vec![vec![0usize; score+1]; one_cnt+1]; n+1]; dp[0][0][0] = 1; for i in 0..n { for j in 0..=one_cnt { for k in 0..=score { if dp[i][j][k] == 0 { continue; } dp[i+1][j][k] += dp[i][j][k]; if j+1 <= one_cnt && k+i+1 <= score { dp[i+1][j+1][k+i+1] += dp[i][j][k]; } } } } println!("{}", dp[n][one_cnt][score]); }