Polynesiaglot (Small 1)

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

Easy3Dynamic programmingCombinatoricsInterviewNo attempts yetTime limit5sMemory limit512 MB

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

  • 1T151 \le T \le 15
  • 1C1001 \le C \le 100
  • 1V1001 \le V \le 100
  • 1L151 \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.