#include <algorithm>
#include <cstring>
#include <cstdio>
const int N=1005,inf=1000000000;
int f[N],g[5005],fst[N],nxt[N],a[N];
void addedge(int x,int y){
	nxt[y]=fst[x];fst[x]=y;
}
bool dfs(int x){
	for (int y=fst[x];y;y=nxt[y])
		if (!dfs(y)) return 0;
	memset(g,0,sizeof g);
	for (int y=fst[x];y;y=nxt[y])
		for (int i=a[x];i>=0;i--){
			int z=inf;
			if (i>=a[y]) z=g[i-a[y]]+f[y];
			if (i>=f[y]) z=std::min(z,g[i-f[y]]+a[y]);
			g[i]=z;
		}
	f[x]=g[a[x]];
	return f[x]<inf;
}
int main(){
	int n;
	scanf("%d\n",&n);
	for (int i=2;i<=n;i++){
		int p;
		scanf("%d",&p);
		addedge(p,i);
	}
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	if (dfs(1)) printf("POSSIBLE\n");
		else printf("IMPOSSIBLE\n");
}