Hamming

이진 문자열의 길이 k 부분수열 모든 쌍에 대해 해밍 거리의 합을 각 k마다 40961로 나눈 나머지를 구한다.

보통7조합론동적 계획법수학아직 제출이 없습니다시간 제한25초메모리 제한1024 MB

문제

You are given a binary string ss of length nn. Compute the sum of pairwise Hamming distances between all subsequences of string ss with length exactly kk for all kk from 11 to nn. Since the answers can be very large, find them modulo 40,96140\\,961.

Hamming distance between two strings of equal length is the number of positions in which these two strings are different.

입력

The only line of input contains a string ss of length nn (1n81031 \le n \le 8 \cdot 10^{3}) containing only characters "0" and "1".

출력

Print nn numbers: kk-th of them must be the sum of pairwise Hamming distances between all subsequences of string ss with length exactly kk, taken modulo 40,96140\\,961.