#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,x,kk,a[N],head[N],dp[N],g[2][N];
struct Tree{int nxt,to;}e[N];
inline void link(int x,int y){e[++kk].nxt=head[x];e[kk].to=y;head[x]=kk;}
void dfs(int u){
	for (int i=head[u];i;i=e[i].nxt) dfs(e[i].to);
	memset(g,63,sizeof(g));g[0][0]=0;
	int now=0,last=1;
	for (int i=head[u];i;i=e[i].nxt){
		swap(now,last);int v=e[i].to;
		memset(g[now],63,sizeof(g[now]));
		for (int j=a[u];~j;j--){
			if (j-a[v]>=0) g[now][j]=min(g[last][j-a[v]]+dp[v],g[now][j]);
			if (j-dp[v]>=0) g[now][j]=min(g[last][j-dp[v]]+a[v],g[now][j]);
		}
	}
	for (int i=0;i<=a[u];i++) dp[u]=min(dp[u],g[now][i]);
}
int main(){
	memset(dp,127,sizeof(dp));
	scanf("%d",&n);
	for (int i=2;i<=n;i++){
		scanf("%d",&x);
		link(x,i);
	}
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	dfs(1);
	if (dp[1]<1e9) puts("POSSIBLE");
	else puts("IMPOSSIBLE");
	return 0;
}