题目描述
Problem Description
The renowned electronics brand SHOI has just released its next-generation electronic product, the Probability Charger, which is leading the world trend:
"Using cutting-edge nanoscale processing technology, whether components and wires can conduct electricity is determined by true random numbers! The SHOI Probability Charger, an indispensable necessity in your life! Will it charge? Try it now!"
The SHOI Probability Charger connects $n$ charging components through $n-1$ wires. During charging, each wire's ability to conduct electricity is determined by probability, and each charging component's direct charging capability is also determined by probability. Subsequently, electrical energy can flow from directly charged components through conducting wires to indirectly charge other components.
As a loyal customer of SHOI, you can't suppress your urge to buy SHOI products. After standing in line for a week, you finally got your hands on the latest model of the SHOI Probability Charger. You can't wait to plug the SHOI Probability Charger into the power source—at this moment, you suddenly wonder, what is the expected number of components that will enter the charging state?
Input Format
The first line contains an integer $n$, the number of charging components in the Probability Charger. The components are numbered from $1$ to $n$.
The next $n-1$ lines each contain three integers $a, b, p$, describing a wire connecting components numbered $a$ and $b$ with a conductivity probability of $p\%$.
The $n+2$th line contains $n$ integers $q_i$, indicating that the direct charging probability of the $i$-th component is $q_i\%$.
Output Format
Output a single line containing a real number, which is the expected number of components that can enter the charging state, rounded to 6 decimal places.
Sample Input and Output
Input Sample #1
3
1 2 50
1 3 50
50 0 0
Output Sample #1
1.000000
Input Sample #2
5
1 2 90
1 3 80
1 4 70
1 5 60
100 10 20 30 40
Output Sample #2
4.300000
Notes
For $30\%$ of the data, $n \leq 5 \times 10^3$.
For $100\%$ of the data, $n \leq 5 \times 10^5$, $0 \leq p, q_i \leq 100$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分