#include<cstdio>
#include<algorithm>
using namespace std;
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x; 
}
#define MN 1000
#define MX 5000
int p[MN+5],x[MN+5],f[MN+5][MX+5];
int main()
{
	int n=read(),i,j;
	for(i=2;i<=n;++i)p[i]=read();
	for(i=1;i<=n;++i)x[i]=read();
	for(i=n;i;--i)for(j=x[p[i]];j>=0;--j)
		f[p[i]][j]=min(x[i]<=j?f[p[i]][j-x[i]]+f[i][x[i]]:1e9,
					   f[i][x[i]]<=j?f[p[i]][j-f[i][x[i]]]+x[i]:1e9);
	puts(f[1][x[1]]<1e9?"POSSIBLE":"IMPOSSIBLE");
}