#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int N;
vector<int> V[1010];
int X[1010];
int b[1010][2][5010];

void mn(int &s,int t){
    s=min(s,t);
}

int dfs(int p,int q){
    int t=0;
    fill(b[q][0],b[q][0]+5010,INF);
    b[q][0][0]=0;
    for(auto u : V[q]){
        int z=dfs(q,u);
        if(z<0) return -1;
        fill(b[q][(t+1)%2],b[q][(t+1)%2]+5010,INF);
        for(int i=0;i<X[q]+1;i++){
            if(i+z<=X[q]) mn(b[q][(t+1)%2][i+z],b[q][t%2][i]+X[u]);
            if(i+X[u]<=X[q]) mn(b[q][(t+1)%2][i+X[u]],b[q][t%2][i]+z);
        }
        t++;
    }
    int m=INF;
    rep(i,X[q]+1) mn(m,b[q][t%2][i]);
    if(m==INF) m=-1;
    return m;
}

int main(){
    cin>>N;
    for(int i=1;i<N;i++){
        int P;
        cin>>P;
        V[P].push_back(i+1);
    }
    for(int i=1;i<N+1;i++) cin>>X[i];

    cout<<(dfs(-1,1)<0 ? "IMPOSSIBLE":"POSSIBLE")<<endl;
}