The first line contains a single integer $T$ ($1 \leq T \leq 300$), the number of test cases. For each test case:
The first line contains a single integer $n$ ($2 \leq n \leq 100\,000$), denoting the upper bound of the level.
The $i$-th ($1\leq i\leq n$) of the following $n$ lines contains two integers $P_{i-1}$ and $c_{i-1}$ ($1 \leq P_{i-1},c_{i-1} \leq 100$), describing the success probability and the cost for level $i-1$. Here $p_{i-1}=\frac{P_{i-1}}{100}$. It is guaranteed that $P_0=100$.
The next line contains $n-1$ integers $w_1,w_2,\dots,w_{n-1}$ ($1\leq w_i\leq 100$).
It is guaranteed that the sum of all $n$ is at most $500\,000$.