Given a binary string of length N(containing only 0's and 1's) and two integers C,P.
Put exactly 3 dividers in the string so that the integer between first and second divider (its decimal equivalent) is C and that between second and third divider is P(its decimal equivalent). There cannot be more than 25 digits in binary representation of P or C(inclusive of preceeding or leading 0's). Find the number of ways to put these dividers.
CONSTRAINTS:
\(1 \le N \le 10^6\)
\(1 \le C,P < 2^{25}\)
INPUT:
The first line contains a string of binary numbers.
The next line contains 2 space-seperated integers C and P
OUTPUT:
In a single line, print the number of ways in which the 3 dividers can be put.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial