You are given an undirected tree G with N nodes. You are also given an array A of N integer elements where A[i] represents the value assigned to node i and an integer K.
You can apply the given operation on the tree at most once:
Find the maximum sum of values of nodes that are available in the tree, after the above operation is used optimally.
Note
Input format
Output format
For each test case, print the maximum possible sum of values of nodes present in the tree. Print the output for each test case in a new line.
Constraints
1≤T≤101≤N≤1050≤A[i]≤1090≤K≤109
For test case 1:
For test case 2: