#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int n;
vector<int> son[1111];
int x[1111];
int z[1111];
int dp1[5555],dp2[5555];
void upd(int&x,int y){
	if(x==-1 || x>y)x=y;
}
int main(){
	scanf("%d",&n);
	for(int i=2; i<=n; i++){
		int y;
		scanf("%d",&y);
		son[y].push_back(i);
	}
	for(int i=1; i<=n; i++){
		scanf("%d",&x[i]);
	}
	for(int i=n; i>=1; i--){
		memset(dp1,-1,sizeof(dp1));
		dp1[0] = 0;
		for(vector<int>::iterator it = son[i].begin(); it!=son[i].end(); it++){
			int black = x[*it], white = z[*it];
			memset(dp2,-1,sizeof(dp2));
			for(int j=0; j<=x[i]; j++)if(dp1[j] != -1){
				if(j + black <= x[i])
					upd(dp2[j+black], dp1[j] + white);
				if(j + white <= x[i])
					upd(dp2[j+white], dp1[j] + black);
			}
			memcpy(dp1,dp2,sizeof(dp2));
		}
		int res = -1;
		for(int j=x[i]; j>=0; j--)if(dp1[j] != -1){
			upd(res, dp1[j]);
		}
		if(res == -1){
			puts("IMPOSSIBLE");
			return 0;
		}
		z[i] = res;
	}
	puts("POSSIBLE");
	return 0;
}