Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

WTRABS - Overflow

 

Phuc made for his girlfriend a shelf that has many floors with rose pots on them. On a raining day, he wonders what will happen If he pours standing water in the top pots down to the bottom pots, how much water will the bottom pots contain?

Phuc made for his girlfriend a shelf that has many floors with rose pots on them. On a raining day, he wonders what will happen If he pours standing water in the top pots down to the bottom pots, how much water will the bottom pots contain?

 

Note that:

- Because of different design, size and position, water from one upper pot can only be poured down to some certain lower pots,  lower pots only receive water from one upper pot

- If there are more than 1 pot below, he divides the amount of water of the upper pot equally to all lower pots.

- If there is no pots below, he writes down the amount of standing water in that pot.

The uppermost pot is numbered with 0.

Input

First line is the number of pots N (1 <= N <= 10^5)

Second line has N integers Ki, each denotes the amount of water in i-th pot (1<= K <= 10^5)

N-1 next lines each has two integers u and v, which means pot u receives water from pot v (u,v < n)

Output

With each pot (ordered by increasing id) containing water, print out on one line the id and the amount of water in it, The amount of water is rounded to the fourth decimal number

Example

Input:
5
16 3 4 2 1
1 0
2 0
3 2
4 2
Output:
1 11.0
3 8.0
4 7.0

Added by:Ha Minh Ngoc
Date:2016-03-16
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.