A. Bitwise Transform
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
001101001011
4
1
2
3
11032025
Output
7
6
6
16