#include<bits/stdc++.h>
using namespace std;
const int N = 500010;
struct edge {
int nxt, to; double p;
} e[N << 1];
int n, cnt = 1;
int head[N];
double p[N], f[N], g[N], q[N];
void link(int u, int v, int p)
{
e[++cnt].nxt = head[u];
head[u] = cnt;
e[cnt].to = v;
e[cnt].p = (double) p / 100;
}
void dfs1(int u, int last)
{
f[u] = 1.0 - q[u];
for(int i = head[u]; i; i = e[i].nxt) if(e[i].to != last)
{
dfs1(e[i].to, u); p[e[i].to] = e[i].p;
f[u] *= f[e[i].to] + (1 - e[i].p) * (1 - f[e[i].to]);
}
}
void dfs2(int u, int last)
{
if(!last) g[u] = 1;
else
{
double t = g[last] * f[last] / (f[u] + (1 - f[u]) * (1 - p[u]));
g[u] = t + (1 - t) * (1 - p[u]);
}
for(int i = head[u]; i; i = e[i].nxt) if(e[i].to != last)
dfs2(e[i].to, u);
}
int main()
{
scanf("%d", &n);
for(int i = 1; i < n; ++i)
{
int u, v, p; scanf("%d%d%d", &u, &v, &p);
link(u, v, p); link(v, u, p);
}
for(int i = 1; i <= n; ++i) scanf("%lf", &q[i]), q[i] /= 100;
dfs1(1, 0); dfs2(1, 0);
double ans = 0;
for(int i = 1; i <= n; ++i) ans += 1 - f[i] * g[i];
printf("%.6lf\n", ans);
return 0;
}