#P1641. Counting Valid Binary Strings
Counting Valid Binary Strings
Counting Valid Binary Strings
lxhgww has recently received a task to generate a binary string using n number of 1's and m number of 0's. However, the string must satisfy the following requirement: in every prefix of the string (i.e. the first k characters for all 0 ≤ k ≤ n+m), the number of 1's is not less than the number of 0's.
If n < m then no string can satisfy the condition, and the answer is 0. Otherwise, one classical combinatorial formula to count such strings is given by:
[ \text{Answer} = \binom{n+m}{m} - \binom{n+m}{m-1} ]
You are to compute the number of valid strings modulo 20100403.
inputFormat
The input consists of a single line containing two integers n and m, representing the number of 1's and 0's respectively.
outputFormat
Output a single integer: the number of valid strings modulo 20100403.
sample
3 2
5