
The dial shows a sequence of numbers in binary format. Dividing lines can be placed either between the numbers or between the digits of a single number, splitting it into two or more numbers. For each sector, you can calculate the sum of the numbers within it.
Each number in the sequence is nonzero and begins with a one. The binary representation of each number contains no more than digits. The total number of digits on the dial does not exceed .
The dial can be divided into sectors. The figure illustrates a familiar dial with numbers from to (in a slightly unconventional form). It is divided into sectors. The sums in these sectors are , , , and .
Write a program named DIAL that calculates the number of different ways to divide the dial into sectors so that the sum of numbers in all sectors is equal, given the sequence.
The sequence of numbers is provided in a single line of the input file, with numbers separated by spaces.
The output file should contain a single natural number, representing the number of ways to divide the dial into sectors as required.
Example 1