#include <bits/stdc++.h>
using namespace std;

struct edge{int s,t,n;}e[1010];
int n,h[1010],v[1010];
bitset <5010> a[1010];

int dfs(int x)
{
	int sum=0,s;
	a[x][0]=1;
	for (int i=h[x],y; y=e[i].t,i; i=e[i].n)
		s=dfs(y),sum+=s+v[y],a[x]=(a[x]<<s)|(a[x]<<v[y]);
	s=v[x];
	for (; (~s)&&(!a[x][s]); s--);
	if (s<0)  puts("IMPOSSIBLE"),exit(0);
	return sum-s;
}

void work()
{
	scanf("%d",&n);
	for (int i=2,p; i<=n; i++)
		scanf("%d",&p),e[i]=(edge){p,i,h[p]},h[p]=i;
	for (int i=1; i<=n; i++)  scanf("%d",&v[i]);
	dfs(1);
	puts("POSSIBLE");
}

int main()
{
	work();
	return 0;
}
