Binary strings are the strings whose each character is either ‘0’ or ‘1’.
You are given x numbers of 0s and y numbers of 1s. Your task is to determine the numbers of binary strings that can be formed with x numbers of 0s and y numbers of 1s for which the following function is true. Since, this count can be large, print answers with mod 999983. The definition of the function that is mentioned in the question is as follows:
bool fun(string s){
one = 0, zero = 0
for(int i = s.length() - 1; i >= 0; i--){
if(s[i] is ‘0’):
zero++
else:
one++
if(zero > one):
return false
}
return true
}
Input format
Output format
For each test case, print the number of valid binary strings that can be formed mod 999983.
Constraints
1≤T≤1051≤x,y≤1016
In the first case, valid strings are 00111, 10011, 01011, 10101, 01101.
In the second case, no valid strings are possible.