atcoder#AGC048F. [AGC048F] 01 Record

[AGC048F] 01 Record

Score : 22002200 points

Problem Statement

Snuke received a big blackboard. Being pleased with this present, he first wrote some positive integers. Then, he repeated the following operation until there was no integer written on the blackboard:

  • Choose one integer written on the blackboard and erase it. Let xx be the erased integer. Then, record the remainder of xx divided by 22 on his notebook. Finally, if x2x \geq 2, write a new integer x1x-1 on the blackboard.

Snuke's record is represented by a string SS consisting of 0 and 1, where SiS_i is the remainder of the chosen integer divided by 22 in the ii-th operation.

Snuke forgot the combination of positive integers he first wrote on the blackboard. From the information given as the string SS, find the number of possible combinations of positive integers he first wrote on the blackboard. Here, we consider combinations aa and bb of positive integers different when there is an integer vv such that the numbers of times vv occurs in aa and vv occurs in bb differ. Since the count can be enormous, compute it modulo (109+7)(10^9+7). Also, it is possible that Snuke's record is incorrect and that no combination of positive integers satisfies the condition. In such a case, just answer 00.

Constraints

  • 1S3001 \leq |S| \leq 300
  • SS is a string consisting of 0 and 1.

Input

Input is given from Standard Input in the following format:

SS

Output

Print the number of possible combinations of positive integers written on the blackboard, modulo (109+7)(10^9+7).

101
2

There are two possible combinations of integers written on the blackboard: {1,2}\{1,2\} and {3}\{3\}.

100
0

There is no possible combination of integers written on the blackboard.

010101
3

There are three possible combinations of integers written on the blackboard: {2,2,2}\{2,2,2\}, {2,4}\{2,4\}, and {6}\{6\}.

11101000111110111101001011110010111110101111110111
3904