AtCoder Beginner Contest 129
E
Sum Equals Xor
AtCoder
⌀ 1547
原题
← DF →
翻译中…

Problem Statement

翻译中…

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

翻译中…
  • $a + b \leq L$
  • $a + b = a \text{ XOR } b$
翻译中…

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

翻译中…

What is XOR? The XOR of integers $A$ and $B$, $A \text{ XOR } B$, is defined as follows: When $A \text{ XOR } B$ is written in base two, the digit in the $2^k$'s place ($k \geq 0$) is $1$ if either $A$ or $B$, but not both, has $1$ in the $2^k$'s place, and $0$ otherwise. For example, $3 \text{ XOR } 5 = 6$. (In base two: $011 \text{ XOR } 101 = 110$.)

翻译中…

Constraints

翻译中…
  • $L$ is given in base two, without leading zeros.
  • $1 \leq L < 2^{100\ 001}$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

L

翻译中…

Output

翻译中…

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

翻译中…

样例

Input #1
10
Output #1
5
Five pairs $(a, b)$ satisfy the conditions: $(0, 0), (0, 1), (1, 0), (0, 2)$ and $(2, 0)$.
Input #2
1111111111111111111
Output #2
162261460
题目信息
题号
abc129_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。