One way investors decide which companies to put their money into (for example, by buying stock) is to read independent assessments. Several services write these up and grade stocks. During the height of financial wheeling and dealing, it seems most companies were judged sound investments even when they had no discernible business model. All it took was a phrase like "a high-yield prospect" and investors would follow like lemmings. In fact, a computer program could probably do the same — and you get to write that program.
Your program receives a piece of text about one or more companies. Certain quality words carry positive or negative connotations. For example, "trouble" is negative and "promising" is positive. Each such word has a base quality score.
Sentences may also contain the modifiers "not", "very", "extremely", and "slightly".
These multipliers accumulate multiplicatively. For instance, the sentence "AIG very trouble extremely very." gives "AIG" a score of $-12$ (assuming "trouble" scores $-1$), because $-1 \times 2 \times 3 \times 2 = -12$. Modifiers apply only within a sentence, and a sentence ends with a '.' (the text contains no ',', ';', ':', or other punctuation).
A text may describe multiple companies. Attribution works as follows: from the point where a company name appears until the next company name (or the end of the text), every word is taken to refer to that company. Any words before the first company name refer to no company. Multiple companies can appear in the same sentence. For example, "AIG trouble Pixar promising very." gives "AIG" a score of $-2$ and "Pixar" a score of $+2$ (with "trouble" $= -1$ and "promising" $= +1$), because "very" applies to both quality words (both share the sentence).
If a company appears across multiple sentences (or multiple blocks of text), the scores from those sentences are added together.
The first line contains the number $K$ of data sets. $K$ data sets follow, each of the form below.
The first line of a data set contains three integers $C$, $Q$, and $L$, where $1 \le C \le 100$ is the number of companies, $1 \le Q \le 100$ is the number of quality words, and $1 \le L \le 1000$ is the number of lines of text. Then come $C$ lines, each holding a company name (letters, possibly with hyphens). Next come $Q$ lines; each contains a quality word $w_i$ (also possibly containing hyphens), a space, and a floating-point number $q_i$, the base quality score of word $i$.
Finally there are $L$ lines of text. Each line has at most $80$ characters. Every character is an upper- or lower-case letter, a hyphen (part of a word), a '.', or a space. Company names match only when the case is identical — "AIG" does not match "aig". Quality words and modifiers match regardless of case — "trouble" matches "tRoubLE" and "Very" matches "veRY". The input guarantees that no two quality words are equal and that no company name equals another company name or a quality word.
For each data set, output "Data Set x:" on its own line, where x is the data set number. Then output the quality scores for all $C$ companies, rounded to two decimals, one per line, in the same order the company names were given. Separate consecutive data sets with a single blank line.