Vihaan has a rooted tree$$$^{\text{∗}}$$$ with $$$n$$$ nodes. The tree is rooted at node $$$1$$$.
Each node $$$i$$$ has an initial value $$$a_i$$$ and a modulus $$$b_i$$$. Let $$$x_i$$$ denote the current value of node $$$i$$$. Initially, $$$x_i=a_i$$$.
Vihaan may perform the following operation any number of times:
After performing any number of operations, Vihaan wants to maximize the sum of the values of all nodes.
Determine the maximum possible sum.
$$$^{\text{∗}}$$$A tree is an undirected connected graph in which there are no cycles.
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of nodes in the tree.
The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$0 \le a_i \lt b_i$$$) — the initial values of the nodes.
The third line contains $$$n$$$ integers $$$b_1,b_2,\ldots,b_n$$$ ($$$1 \le b_i \le 10^9$$$) — the moduli of the nodes.
Each of the next $$$n-1$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) — an edge between nodes $$$u$$$ and $$$v$$$.
It is guaranteed that the given edges form a tree.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, print one integer — the maximum possible sum of the values of all nodes after performing any number of operations.
813720 35 41 230 2 37 3 41 22 330 0 15 2 21 22 341 2 3 410 3 4 51 21 31 430 1 310 2 41 21 350 0 1 2 312 6 9 3 41 21 32 43 540 999999999 999999999 9999999991000000000 1000000000 1000000000 10000000001 21 31 4
371161812273999999996
In the first test case, node $$$1$$$ has no children, so performing an operation on it does not change its value. Thus, the maximum possible sum is $$$3$$$.
In the third test case, Vihaan can perform the operation on node $$$1$$$ three times:
In the fourth test case, Vihaan can perform the following operations: