Problem: You are given a string consisting of characters "1", "0", and "?". The first character of is guaranteed to be "1". Let be the number of characters in .
Count the number of ways we can choose a pair of integers that satisfies the following:
- When written without leading zeros, the base-2 representations of and are both palindromes.
- The base-2 representation of bitwise XOR of and matches the pattern . We say that matches if the lengths of and are the same and for every , the -th character of is equal to the -th character of , or the -th character of is "?".
Compute this count modulo .
Input Format: The first line contains a single string (). consists only of characters "1", "0" and "?". It is guaranteed that the first character of is a "1".
Output Format: Print a single integer, the count of pairs that satisfy the conditions modulo .
Note: For the first example, the pairs in base-2 are .