On July 1st, Ontario's Provincial Sales Tax (PST) was merged with the Federal Goods and Services Tax (GST) to create the Harmonized Sales Tax (HST). This changed the rate of tax that Ontarians pay on various items.
Dalton would like to calculate how this change will affect his personal monthly budget.
The first line of input contains a single integer: the number of test cases that follow.
Each test case begins with a line containing two integers $N$ and $M$ — the number of categories of items and the number of purchases Dalton makes each month. Each of $N$ and $M$ is between 1 and 100000, inclusive.
The next $N$ lines each describe a category. A category line contains a category name — a string of at most 30 letters — followed by three percentages giving the PST, GST, and HST rate for that category. Each percentage has up to two digits after the decimal point and is written with a trailing % symbol; every percentage is at least 0% and at most 100%.
The following $M$ lines each describe one of Dalton's purchases. A purchase line contains a category name followed by a price in dollars and cents prefixed by a \$ sign; this is the pre-tax amount Dalton spends on an item in that category.
The amount of each tax on an item is rounded to the nearest cent; if the tax amount is exactly half a cent above a whole number of cents, it is rounded up to the next whole cent.
For each test case, output on its own line the difference, in dollars and cents (two digits after the decimal point), between the total HST payable and the total PST plus GST payable on Dalton's monthly purchases. Output a positive amount if the HST exceeds the PST plus GST, and a negative amount (prefixed with -) if the HST is less.