Dice Race Between Alice and Bob
Alice and Bob are locked in a dice-rolling contest. They take turns rolling a fair six-sided die, starting with Alice, and each keeps a running total of their rolls. Alice wins if she reaches a sum of at least n before Bob reaches a sum of at least m. What is the probability that Alice wins?
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 100).
Output
Print the probability that Alice wins as a fraction modulo 10⁹ + 7. If the probability is p/q in lowest terms, output p · q⁻¹ (mod 10⁹ + 7), where q⁻¹ is the modular inverse of q modulo 10⁹ + 7.
Notes
- A player wins as soon as their running total reaches or exceeds their target (n for Alice, m for Bob).
- The probability should be output as a single integer representing the fraction modulo 10⁹ + 7.
- Use Fermat's Little Theorem to compute modular inverses:
q⁻¹ ≡ q^(10⁹+5) (mod 10⁹+7).