// MADE BY QT666
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
const int N=1000050;
const double eps=1e-9;
double dp[N],p[N],q[N];
int head[N],nxt[N],to[N],fa[N],cnt,n;
void lnk(int x,int y,double g){
to[++cnt]=y,nxt[cnt]=head[x],p[cnt]=g,head[x]=cnt;
to[++cnt]=x;nxt[cnt]=head[y],p[cnt]=g,head[y]=cnt;
}
void dfs1(int x,int f){
dp[x]=(1-q[x]);
for(int i=head[x];i;i=nxt[i]){
int y=to[i];
if(y!=f){
fa[y]=x;dfs1(y,x);
dp[x]*=(1-p[i]*(1-dp[y]));
}
}
}
void dfs2(int x){
for(int i=head[x];i;i=nxt[i]){
int y=to[i];
if(y!=fa[x]){
double gg=1-dp[x]/(1-p[i]*(1-dp[y]));
if(gg>eps) dp[y]*=(1-p[i]*gg);
dfs2(y);
}
}
}
int main(){
scanf("%d",&n);
for(int i=1;i<n;i++){
int a,b;double g;
scanf("%d%d",&a,&b);scanf("%lf",&g);g/=100;
lnk(a,b,g);
}
for(int i=1;i<=n;i++) scanf("%lf",&q[i]),q[i]/=100;
double ans=0;dfs1(1,1);dfs2(1);
for(int i=1;i<=n;i++) ans+=(1-dp[i]);
printf("%.6f\n",ans);
return 0;
}