Bailout Bonus

No attempts yetTime limit1sMemory limit128 MB

Problem

To keep many financial companies from collapsing, the United States government (and several other governments) bailed them out by providing multi-billion-dollar emergency loans. Afterward, several of these companies went ahead and paid their executives large performance bonuses. After a public outcry, one measure taken to recover this money for the government was to impose a hefty 95% tax on the bonuses of employees at any company that had received bailout money. Your task is to compute how much money the government recovers.

You are given a list of the companies that received bailout money and the proposed tax rate $r$ (such as 95%), written as an integer (in this case, $95$). You are also given a list of executives, each with their company affiliation and proposed bonus. Every executive who works for a bailed-out company must pay back an $r$ percent fraction of their bonus, rounded down to the nearest integer. For simplicity, executives who work for companies that were not bailed out return none of their bonus.

Input

The first line contains the number of data sets, $K$. It is followed by $K$ data sets, each of the following form.

The first line of a data set contains four integers $C$, $B$, $n$, and $r$:

  • $1 \le C \le 500$ is the total number of companies.
  • $0 \le B \le C$ is the number of those companies that were bailed out.
  • $1 \le n \le 10000$ is the total number of executives.
  • $0 \le r \le 100$ is the tax rate, in percent.

The next line contains $B$ integers: the indices (each between $1$ and $C$) of the bailed-out companies. When $B = 0$, this line is empty. Then follow $n$ lines, each describing one executive. Each such line contains two integers $c_i$ and $p_i$, where $1 \le c_i \le C$ is the company that executive $i$ works for and $p_i$ is the bonus that executive $i$ received.

Output

For each data set, first print Data Set x: on a line by itself, where $x$ is the number of the data set (starting from $1$). On the next line, print the total amount of money the government recovers through taxes for that data set. Print a blank line between consecutive data sets.