#include <bits/stdc++.h>
using namespace std;
int d[5005],e[5005],n,x,w[1005],f[1005]; vector <int> a[1005];
void dfs(int x){
	for (int i=0;i<a[x].size();++i) dfs(a[x][i]);
	for (int i=1;i<=w[x];++i) d[i]=0; d[0]=1;
	for (int i=0,y;i<a[x].size();++i){
		y=w[a[x][i]]; f[x]+=f[a[x][i]];
		for (int i=y;i<=w[x];++i) e[i]=d[i-y];
		y=f[a[x][i]]-y;
		for (int i=y;i<=w[x];++i) e[i]|=d[i-y];
		for (int i=0;i<=w[x];++i) d[i]=e[i],e[i]=0;
	}
	int i; for (i=w[x];~i;--i) if (d[i]) break;
	if (i<0) {puts("IMPOSSIBLE"); exit(0);}
	f[x]+=w[x]-i;
}
int main(){
	scanf("%d",&n);
	for (int i=2;i<=n;++i)
		scanf("%d",&x),a[x].push_back(i);
	for (int i=1;i<=n;++i) scanf("%d",&w[i]);
	dfs(1); puts("POSSIBLE");
	return 0;
}