// Hydro submission #672ad966a05967896663408b@1730861414745
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,p[N],fa[N],sz[N];
long double w[N],ans[N];
priority_queue<pair<int,int>> pq;
int find(int x) {return fa[x]==x?x:fa[x]=find(fa[x]);}
int main() {
cin>>n;
for(int i=2; i<=n; i++) cin>>p[i];
for(int i=1; i<=n; i++) cin>>w[i];
for(int i=1; i<=n; i++) pq.push(make_pair(w[i],i)),fa[i]=i,sz[i]=1;
while(!pq.empty()) {
int u=pq.top().second;
pq.pop();
if(fa[u]!=u) continue;
ans[u]=w[u]/sz[u];
int x=fa[u]=find(p[u]);
if(!x) continue;
w[x]+=w[u],sz[x]+=sz[u];
pq.push(make_pair(w[x]/sz[x],x));
}
for(int i=1; i<=n; i++) printf("%.10Lf\n",ans[i]);
return 0;
}