Hard To Explain

루트에서 특정 정점까지의 경로에서 C_i >= T인 정점들 중 A_i + B_i*T의 최솟값을 각 질의마다 구한다.

어려움9트리분할 정복세그먼트 트리이분 탐색아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

You are given a tree with NN vertices and N1N-1 edges. Vertex 1 is the root of the tree. Every vertex is associated with three positive integers A_i,B_i,C_iA\_i, B\_i, C\_i, where C_1=109C\_1 = 10^9 and B_parent(x)B_xB\_{parent(x)} \le B\_x for all x1x \neq 1, where parent(x)parent(x) is the parent node of xx.

If you see a tree with numbers, you naturally want to ask some queries. For each query, you are given a vertex VV and number TT. Then, you should find a minimum value of A_i+B_i×TA\_i + B\_i \times T, for all vertex ii which lies in some shortest path between vertex 11 and VV, and which satisfies C_iTC\_i \geq T. Note that, if T109T \le 10^9, then there exists a minimum value.

입력

In the first line, two integers N,QN, Q are given. (1N80000,1Q1600001 \le N \le 80000, 1 \le Q \le 160000).

In the next line, NN integers A_1,A_2,,A_NA\_1, A\_2, \cdots, A\_N are given. (1A_i1091 \le A\_i \le 10^9)

In the next line, NN integers B_1,B_2,,B_NB\_1, B\_2, \cdots, B\_N are given. (1B_i1091 \le B\_i \le 10^9)

In the next line, NN integers C_1,C_2,,C_NC\_1, C\_2, \cdots, C\_N are given. (1C_i1091 \le C\_i \le 10^9)

In the next N1N-1 lines, two integers X,YX, Y denoting the endpoints of edges are given. (1X,YN1 \le X, Y \le N)

In the next QQ lines, two integers V,TV, T denoting the arguments of queries are given. (1VN,0T1091 \le V \le N, 0 \le T \le 10^9)

It is guaranteed that C_1=109C\_1 = 10^9, and B_parent(x)B_xB\_{parent(x)} \le B\_x for all x1x \neq 1, when parent(x)parent(x) is the parent node of xx.

출력

Print QQ lines. In each line, print a single integer which is the minimum value asked by the given query.