#include<cstdio>
#include<bitset>
#include<vector>
#include<cstdlib>
using namespace std;
const int N=1145;
int n,fa[N],X[N],a[N];
vector<int>G[N];
bitset<5001>b;
void dfs(int now){
	int sum=0;
	for(int to:G[now])dfs(to),sum+=a[to];
	b.reset();
	b.set(0);
	for(int to:G[now])b=(b<<X[to])|(b<<(a[to]-X[to]));
	int x=-1;
	for(int i=X[now];~i&&x==-1;--i)if(b.test(i))x=i;
	if(x==-1)exit(puts("IMPOSSIBLE")*0);
	a[now]=sum+X[now]-x;
}
int main(){
	scanf("%d",&n);
	for(int i=2;i<=n;++i)
		scanf("%d",fa+i),G[fa[i]].push_back(i);
	for(int i=1;i<=n;++i)scanf("%d",X+i);
	dfs(1);
	puts("POSSIBLE");
	return 0;
}