I guess I have the problem statement.
You are given a positive Integer N in base two. Your task is to print the total number of pairs of non-negative integers (a, b) that satisfy the following conditions.
- a + b \le N
- a + b = a \oplus b
Here \oplus operation represents the bitwise XOR Operation.
Since the answer could be extremely large print it modulo 10^9 + 7
Note: The Input does not contain leading zeroes.
Input Format
The first line contains a string, N, denoting the Integer N in base two.
Constraints
1 \le |N| \le 10^5
Sample Input(s)
Input 1
10
Output 1
5
Explanation 1
Pairs satisfying the conditions are: (0, 0), (0, 1), (0, 2), (1, 0), (2, 0)
Input 2
100
Output 2
11
Explanation 2
There are many, but I guess you can understand
Input 3
1111111111
Output 3
59049
Explanation 3
Sample case for debugging purpose
My Approach (In between Naive and Optimal)
I read the given String into an Integer. In Python, int(input(), 2) converts the given binary string into an integer. Then, I applied the Recurrence relation using a Dictionary to store previously calculated values. But still, it didn’t work for large values of N. 
Coming to the time complexity, I guess it’s O(N\log N), where N is the length of Binary String.




