#Lutece0008. God Only Knows!

God Only Knows!

Migrated from Lutece 8 God Only Knows!

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Zplinti1 is given a big and long string SS, together with a list of strings that are viruses. He wants to find the number of substrings of SS, so that it does not contain any viruses. Same substrings with different starting positions are regarded as different!

Zplinti1 finds this problem difficult enough, he thinks Only God Can Solve This Problem, but you don’t think so, right?

Input

The first line of input contains a number TT, indicating the number of cases. (T30T\leq 30) For each case, the first line is a string SS, with length no more than 1,000,0001,000,000. The second line is a number nn, which is the number of virus strings. Then nn lines comes, each with a string.

All the strings contains lowercase letters from a to z only. The total length of all virus strings in one case will be no more than 100,000100,000.

Output

For each case, output Case #i: first. (ii is the number of the test case, from 11 to TT). Then output the number of substrings of SS that do not contain any virus.

Samples

3
aabc
0
aabbaa
1
a
abcdefg
2
bcd
ef
Case #1: 10
Case #2: 3
Case #3: 14

Note

A substring of a string SS is a continuous string taken from SS. For example if we take out the letters from the LthL_{th} to the RthR_{th} of the string, then the substring will be (SL,SL+1SRS_L, S_{L+1}\cdots S_R).

The original string is a substring of itself.

When we say string AA contains string BB, it means that BB is a substring of AA.

Resources

The 11th UESTC Programming Contest Final