You have a quantum computer containing two binary strings
Input Specification
The first line contains three integers,
The next line contains the string
The last line contains the string
Output Specification
Find the probability of turning
Constraints
Subtask | Score | Constraints |
---|---|---|
1 | 10% | |
2 | 12% | |
3 | 18% | |
4 | 12% | |
5 | 48% |
Sample Input 1
Copy
4 1 2
0000
0000
Sample Output 1
Copy
250000002
Explanation For Sample 1
The probability is
Sample Input 2
Copy
4 2 1
0000
0000
Sample Output 2
Copy
0
Sample Input 3
Copy
6 4 3
010000
100000
Sample Output 3
Copy
932444451
Sample Input 4
Copy
6 1 43
010000
011110
Sample Output 4
Copy
242545047
Sample Input 5
Copy
6 3 0
010000
010000
Sample Output 5
Copy
1
Sample Input 6
Copy
1 1 9
0
1
Sample Output 6
Copy
1
Comments