|
<p> |
|
In the game of <em>Sports</em>, the object is have more points than the other |
|
team after a certain amount of time has elapsed. Scores are denoted by |
|
two hyphen-separated integers. For example, scores may include 3-2, |
|
4-1, or 10-0. The first number is how many points you've scored, and the second |
|
is the number of points scored by the opposing team. You're very good at |
|
<em>Sports</em>, and consequently you always win. However, you don't always |
|
achieve victory the same way every time. |
|
</p> |
|
|
|
<p> |
|
The two most extreme kinds of victory are called <strong>stress-free</strong> and |
|
<strong>stressful</strong>. In a <strong>stress-free</strong> victory, you score the first |
|
point and from then on you always have more points than your opponent. |
|
In a <strong>stressful</strong> victory, you never have more points than your opponent |
|
until after their score is equal to their final score. |
|
</p> |
|
|
|
<p> |
|
Given the final score of a game of <em>Sports</em>, how many ways could you |
|
arrange the order in which the points are scored such that you secure a |
|
<strong>stress-free</strong> or <strong>stressful</strong> win? |
|
</p> |
|
|
|
<h3>Input</h3> |
|
|
|
<p> |
|
Input begins with an integer <strong>T</strong>, the number of games |
|
you'll play. For each game, there is one line containing the final score of |
|
the game in the format described above. |
|
</p> |
|
|
|
|
|
<h3>Output</h3> |
|
|
|
<p> |
|
For the <strong>i</strong>th game, print a line containing "Case #<strong>i</strong>: " |
|
followed by two space-separated integers, the number |
|
of ways you can achieve a <strong>stress-free</strong> or <strong>stressful</strong> win, |
|
respectively. Since these numbers may be very large, output them modulo |
|
1,000,000,007. |
|
</p> |
|
|
|
|
|
<h3>Constraints</h3> |
|
<p> |
|
1 ≤ <strong>T</strong> ≤ 100 <br /> |
|
</p> |
|
|
|
<p> |
|
Since you always win, the first number in any final score |
|
will always be larger than the second. Both scores will be non-negative |
|
integers not exceeding 2000. |
|
</p> |
|
|
|
<h3>Explanation of Sample</h3> |
|
<p> |
|
In the third test case, you can get a stress-free win by scoring points 1, 2, and 4, or points 1, 2, and 3. |
|
You can get a stressful win by scoring points 2, 4, and 5, or points 3, 4, and 5. |
|
</p> |
|
|
|
|