A tree with vertices is a connected undirected graph with
vertices and
edges.
You are given a tree with vertices. Each vertex has a value
. Note that for any two vertices there is exactly one single path between them, whereas a simple path doesn't contain any edge more than once. The length of a simple path is considered as the number of edges in it.
You need to pick up a simple path whose length is not smaller than and select a real number
. Let
be the set of vertices in the simple path. You need to calculate the maximum of
.
The first line contains a single integer
(
), indicating the number of vertices in the tree.
The second line contains
integers
(
), indicating the values of each vertex.
Each line in the next
lines contains two integers
, indicating an edge in the tree.
The output contains a single real number, indicating the answer.
Your answer will be accepted if and only if the absolute error between your answer and the correct answer is not greater than
.