You are given a binary string s of length n. Compute the sum of pairwise Hamming distances between all subsequences of string s with length exactly k for all k from 1 to n. Since the answers can be very large, find them modulo 40,961.
Hamming distance between two strings of equal length is the number of positions in which these two strings are different.