100 atcoder#ABC129E. [ABC129E] Sum Equals Xor

[ABC129E] Sum Equals Xor

Score : 500500 points

Problem Statement

You are given a positive integer LL in base two. How many pairs of non-negative integers (a,b)(a, b) satisfy the following conditions?

  • a+bLa + b \leq L
  • a+b=a XOR ba + b = a \text{ XOR } b

Since there can be extremely many such pairs, print the count modulo 109+710^9 + 7.

What is XOR?

The XOR of integers AA and BB, A XOR BA \text{ XOR } B, is defined as follows:

  • When A XOR BA \text{ XOR } B is written in base two, the digit in the 2k2^k's place (k0k \geq 0) is 11 if either AA or BB, but not both, has 11 in the 2k2^k's place, and 00 otherwise.

For example, 3 XOR 5=63 \text{ XOR } 5 = 6. (In base two: 011 XOR 101=110011 \text{ XOR } 101 = 110.)

Constraints

  • LL is given in base two, without leading zeros.
  • 1L<2100 0011 \leq L < 2^{100\ 001}

Input

Input is given from Standard Input in the following format:

LL

Output

Print the number of pairs (a,b)(a, b) that satisfy the conditions, modulo 109+710^9 + 7.

10
5

Five pairs (a,b)(a, b) satisfy the conditions: (0,0),(0,1),(1,0),(0,2)(0, 0), (0, 1), (1, 0), (0, 2) and (2,0)(2, 0).

1111111111111111111
162261460