#P1710C. XOR Triangle
XOR Triangle
Description
You are given a positive integer . Since may be very large, you are given its binary representation.
You should compute the number of triples with such that , , and are the sides of a non-degenerate triangle.
Here, denotes the bitwise XOR operation.
You should output the answer modulo .
Three positive values , , and are the sides of a non-degenerate triangle if and only if , , and .
The first and only line contains the binary representation of an integer () without leading zeros.
For example, the string 10 is the binary representation of the number , while the string 1010 represents the number .
Print one integer — the number of triples satisfying the conditions described in the statement modulo .
Input
The first and only line contains the binary representation of an integer () without leading zeros.
For example, the string 10 is the binary representation of the number , while the string 1010 represents the number .
Output
Print one integer — the number of triples satisfying the conditions described in the statement modulo .
Note
In the first test case, .
- The triple is valid because are the sides of a non-degenerate triangle.
- The triple is valid because are the sides of a non-degenerate triangle.
The permutations of each of these two triples are all the valid triples, thus the answer is .
In the third test case, . The full answer (before taking the modulo) is .