In a competitive market, private health insurance is supposed to let each patient pick the plan that best fits their needs. In practice this is hard: it is difficult to predict in advance which benefits you will actually use, and reading a plan's fine print to tell what is and isn't covered is not trivial. In this problem you are given descriptions of several health plans (their premiums and co-payments), together with your projected doctor visits for the coming year, and you must compute the total cost of each plan.
The descriptions are parsed as follows.
.. All other punctuation (spaces, line breaks, commas, semicolons) can be ignored.., ,, ;, and the characters % and $. All numbers are integers.The descriptions talk about the following.
plan, the next word in that sentence is the name of the plan being described. All information up to (but not including) the next sentence that contains the word plan refers to that plan.premium, the integer that has a dollar sign immediately before or after it, or is immediately followed by the word dollars, is the plan's premium (in dollars). There is exactly one such number.copayment or copay:
dollars, is your maximum copay in dollars (you are never asked to pay more).percent expresses the copay as a percentage of the actual visit cost.per visit or total. If neither appears, the copay is a total. If both appear, it is per visit. (Premiums have no per-visit/total distinction.)premium or copayment/copay, and contains the word plan at most once.0.After the plan descriptions you are given a list of doctor visits, each described by a single number: the cost of that visit. Your task is to report the total expense (premium plus copayments) for each plan.
The first line contains the number K of data sets. Each of the K data sets has the following form.
m and n ($1 \le m, n \le 1000$).m lines are the text describing the health plans. Each line has at most 80 characters. There is always at least one plan. A line may contain several sentences, and a sentence may span several lines.n lines each contain one integer: the cost of one doctor visit.For each data set, first print Data Set x: on its own line, where x is the data set's number (starting from 1). Then print, one per line, the total amount of money you must spend (premium plus copays) for each plan, rounded to two decimals. The plans are listed in the order in which they are first mentioned in the text. Consecutive data sets are separated by a blank line.