#include<vector>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define il inline
using namespace std;
typedef long long ll;
const int maxn=8010,inf=2e8;
il int gi ( ){
    int o=0,fl=1;
    char ch=getchar();
    while(!isdigit(ch))fl^=ch=='-',ch=getchar();
    while(isdigit(ch))o=o*10+ch-'0',ch=getchar();
    return fl?o:-o;
}
vector<int>p[maxn];
char s[maxn];
int f[maxn],v[maxn],dp[maxn],n;
il void dfs(int x){
    for(int i=0;i<p[x].size();i++)dfs(p[x][i]);
    memset(dp,0x3f,sizeof(dp));dp[0]=0;
    for(int ii=0;ii<p[x].size();ii++){
        int k=p[x][ii];
        for(int i=v[x];~i;--i){
            int tmp=inf;
            if(i>=v[k])tmp=min(tmp,dp[i-v[k]]+f[k]);
            if(i>=f[k])tmp=min(tmp,dp[i-f[k]]+v[k]);
            dp[i]=tmp;
        }
    }
    for(int i=v[x];i>=0;i--)
        f[x]=min(f[x],dp[i]);
    return;
}
int main(){
	n=gi();
	for(int i=2;i<=n;++i)p[gi()].push_back(i);
	for(int i=1;i<=n;++i)v[i]=gi(),f[i]=2e9;
	dfs(1);
	if(f[1]==inf)printf("IM");
	puts("POSSIBLE");
	return 0;
}
