#include<bits/stdc++.h>
using namespace std;
bitset<5010> can;
int fa[5010],a[5010],f[5010];
vector <int> des[5010];
int main()
{
	int n;scanf("%d",&n);
	for (int i=2;i<=n;i++) {scanf("%d",&fa[i]);des[fa[i]].push_back(i);}
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int s=n;s>=1;s--)
	{
		int all=0,ad=0;
		for (int k=0;k<des[s].size();k++)
		{
			all+=min(a[des[s][k]],f[des[s][k]]);
			ad+=max(a[des[s][k]],f[des[s][k]])-min(a[des[s][k]],f[des[s][k]]);
		}
		if (a[s]<all) {puts("IMPOSSIBLE");return 0;}
		can.reset();can[0]=1;
		for (int k=0;k<des[s].size();k++)
			can|=(can<<(max(a[des[s][k]],f[des[s][k]])-min(a[des[s][k]],f[des[s][k]])));
		for (int i=a[s]-all;i>=0;i--) if (can[i]) {f[s]=all+ad-i;break;}
		//cout<<s<<' '<<f[s]<<endl;
	}  
	puts("POSSIBLE");
} 