#1258
Unrated
Mag
시간 제한
4s
메모리 제한
256MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

You are given an undirected tree with each of its node assigned a magic XiX_{i}. The magic of a path is defined as the product of the magic of the nodes on that path divided by the number of the nodes on the path. For example, the magic of a path that consists of nodes with magic 3 and 5 is 7.5 (3 ⋅ 5 / 2). In the given tree, find the path with the minimal magic and output the magic of that path.

입력

The first line of input contains the integer N (1 ≤ N ≤ 10610^{6}), the number of nodes in the tree. Each of the following N - 1 lines contains two integers, AiA_{i} and BiB_{i} (1 ≤ AiA_{i}, BiB_{i} ≤ N), the labels of nodes connected with an edge. The i-th of the following N lines contains the integer XiX_{i} (1 ≤ XiX_{i}10910^{9}), magic of the i-th node.

출력

Output the magic of the path with minimal magic in the form of a completely reduced fraction P / Q (P and Q are relatively prime integers). In all test cases, it will hold that the required P and Q are smaller than 101810^{18}.

채점

In test cases worth 24 points total, it will hold N ≤ 1 000. In test cases worth 36 additional points total, there will not be a node that is connected to more than 2 other nodes.

예제 입력 1

2
1 2
3
4

예제 출력 1

3/1

예제 입력 2

5
1 2
2 4
1 3
5 2
2
1
1
1
3

예제 출력 2

1/2
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.