#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;
}
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]);
	for (int x=n;x>=1;x--){
		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;
			}
		if ((f[x]=g[a[x]])>=inf){
			printf("IMPOSSIBLE\n");
			return 0;
		}
	}
	printf("POSSIBLE\n");
}