#include<bits/stdc++.h>

using namespace std;

const int N=1005,M=5005;
typedef bitset<M> bst;

int n,li[N],mv[M],sum;
vector<int>e[N];
bst vi;

int main(){
	scanf("%d",&n);
	for(int i=2,u;i<=n;i++)scanf("%d",&u),e[u].push_back(i);
	for(int i=1;i<=n;i++)scanf("%d",&li[i]);
	for(int u=n;u>=1;u--){
		vi=1;sum=0;
		for(int v:e[u])vi=(vi<<li[v])|(vi<<mv[v]),sum+=li[v]+mv[v];
		int i=li[u];
		while(i>=0&&!vi[i])i--;
		if(i>=0)mv[u]=sum-i;
		else puts("IMPOSSIBLE"),exit(0);
	}
	puts("POSSIBLE");
	return 0;
}