#include <bits/stdc++.h>
const int N=1005;
int f[N],a[N],dp[N][5005],sum[N],n;
int main(){
	scanf("%d",&n);
	for (int i=2;i<=n;i++) scanf("%d",&f[i]);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) dp[i][0]=1;
	for (int i=n;i>=1;i--){
		int mini=-1;
		for (int j=a[i];j>=0;j--)
			if (dp[i][j]){
				mini=a[i]-j;
				break;
			}
		sum[i]+=mini;
		if (mini==-1){
			puts("IMPOSSIBLE");
			return 0;
		}
		if (f[i]){
			int fa=f[i];
			for (int j=a[fa];j>=0;j--){
				int t=0;
				if (j>=a[i]) t|=dp[fa][j-a[i]];
				if (j>=sum[i]-a[i]) t|=dp[fa][j-(sum[i]-a[i])];
				dp[fa][j]=t;
			}
			sum[fa]+=sum[i];
		} 
	}
	puts("POSSIBLE");
	return 0;
}