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

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
struct edge
{
	int v,next;
}vs[2010];
int st[2010],ee,n,val[2010],Fs[2010];
int wss[2010][6010],tmp[6010],fg;
inline void addedge(int u,int v)
{
	vs[++ee].v=v;vs[ee].next=st[u];st[u]=ee;
}
inline void dfs(int rt)
{
	memset(wss[rt],-1,sizeof wss[rt]);
	wss[rt][0]=0;
	for(int i=st[rt];i;i=vs[i].next)
	{
		dfs(vs[i].v); 
		if(fg==1) return ;
		int v=vs[i].v;
		memset(tmp,-1,sizeof tmp);
		for(int i=5000;i>=val[v];i--) if(wss[rt][i-val[v]]!=-1)
		{
			if(tmp[i]==-1) tmp[i]=wss[rt][i-val[v]]+Fs[v];
			else tmp[i]=min(tmp[i],wss[rt][i-val[v]]+Fs[v]);
		}
		for(int i=5000;i>=Fs[v];i--) if(wss[rt][i-Fs[v]]!=-1)
		{
			if(tmp[i]==-1) tmp[i]=wss[rt][i-Fs[v]]+val[v];
			else tmp[i]=min(tmp[i],wss[rt][i-Fs[v]]+val[v]);
		}
		for(int i=0;i<=5000;i++) wss[rt][i]=tmp[i];
	}
	//for(int i=0;i<=10;i++) printf("%d ",wss[rt][i]); printf("\n");
	Fs[rt]=0x3fffffff;
	for(int i=0;i<=min(val[rt],5000);i++) if(wss[rt][i]!=-1)
		Fs[rt]=min(Fs[rt],wss[rt][i]);
	if(Fs[rt]==0x3fffffff) fg=1;
}
signed main()
{
	n=read(); for(int i=2;i<=n;i++)
	{
		int k=read(); addedge(k,i);
	}
	for(int i=1;i<=n;i++) val[i]=read();
	dfs(1);
	if(fg) puts("IMPOSSIBLE");
	else puts("POSSIBLE");
	return 0;
}