#include<bits/stdc++.h>
using namespace std;
#define N 1116
#define inf 1111111116

int n,p[N],x[N],f[N][5555];

int read(){
	int x=0;char ch=getchar();
	for (;!isdigit(ch);ch=getchar());
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x;
}

int main(){
	n=read();
	for (int i=2;i<=n;i++) p[i]=read();
	for (int i=1;i<=n;i++) x[i]=read();
	for (int i=n;i>=1;i--){
		int t=inf;
		for (int j=0;j<=x[i];j++) t=min(t,f[i][j]);
		if (t==inf) {printf("IMPOSSIBLE\n");return 0;}
		for (int j=x[p[i]];j>=0;j--)
			f[p[i]][j]=min((j<t)?inf:(f[p[i]][j-t]+x[i])
					   ,(j<x[i])?inf:(f[p[i]][j-x[i]]+t));
	}
	printf("POSSIBLE\n");
	return 0;
}