Under construction

Still being built. Things may change

Polynesiaglot (Small 1)

Interview

Time limit5sMemory limit512 MB

Summary
Count length-L words over C consonants and V vowels in which each consonant is directly followed by a vowel, modulo 1000000007.
Level

Easy3 of 10

Topics
Dynamic programming, Combinatorics
Solved
No attempts yet

Problem

Ursula likes to build constructed languages. Today she starts one inspired by real Polynesian languages, and so far she has fixed two rules.

  • Every word is made of letters. Each letter is a consonant or a vowel.
  • Every consonant in a word must be immediately followed by a vowel.

For example, in a language whose only vowel is a and whose only consonant is h, the words a, aa, aha, aaha, and haha are valid, while h, ahh, ahah, and ahha are not. The second rule forbids a consonant followed by another consonant, and it also forbids a word that ends with a consonant.

Ursula's language has CC different consonants and VV different vowels. Count the valid words of length LL. The answer can be very large, so print it modulo the prime 109+710^9+7.

Input

The first line contains the number of test cases TT. Each of the next TT lines contains three integers CC, VV, and LL, separated by spaces.

Limits

  • 1≤T≤151 \le T \le 15
  • 1≤C≤1001 \le C \le 100
  • 1≤V≤1001 \le V \le 100
  • 1≤L≤151 \le L \le 15

Output

For each test case, print one line of the form Case #x: y, where x is the test case number starting from 1 and y is the number of valid words of length LL, modulo 109+710^9+7.

Note

Take C=1C = 1, V=1V = 1, L=4L = 4. Write the vowel as a and the consonant as h. The valid words are aaaa, aaha, ahaa, haaa, and haha, so the answer is 5.

Take C=1C = 1, V=2V = 2, L=2L = 2. Write the vowels as a and e and the consonant as h. The valid words are aa, ae, ea, ee, ha, and he, so the answer is 6.

Examples1

  1. Example 1

    Input
    2
    1 1 4
    1 2 2
    
    Expected output
    Case #1: 5
    Case #2: 6