时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
            空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
             64bit IO Format: %lld
        
     
    题目描述
        
        
    
            
            White Cloud has a tree with n nodes.The root is a node with number 1. Each node has a value.
 White Rabbit wants to travel in the tree 3 times. In Each travel it will go through a path in the tree.
 White Rabbit can't pass a node more than one time during the 3 travels. It wants to know the maximum sum value of all nodes it passes through. 
  
 
  
                            输入描述:
                                                    The first line of input contains an integer n(3 <= n <= 400001)
In the next line there are n integers in range [0,1000000] denoting the value of each node.
For the next n-1 lines, each line contains two integers denoting the edge of this tree.
                                                                            输出描述:
                                                    Print one integer denoting the answer.
                                                                            
                        
                            示例1
                        
                        
                            
                                输入
                                复制
                                
                                
                                    13
10 10 10 10 10 1 10 10 10 1 10 10 10
1 2
2 3
3 4
4 5
2 6
6 7
7 8
7 9
6 10
10 11
11 12
11 13