#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 5e3 + 3;

vector< int > V[N]; 
int M[N][N],AT[N],dpT[N],t,dp[N],A[N];

int g(int i, int s){
    if(s < 0) return mod;
    if(i == t+1) return 0;
    int &r = M[i][s];
    if(r != -1) return r;
    return r = min( g(i+1,s-AT[i]) + dpT[i] , g(i+1,s-dpT[i]) + AT[i] );    
}

void f(int x){
    
    for(int i=0; i<V[x].size(); i++)
        f(V[x][i]);

    t = 0;
    for(int i=0; i<V[x].size(); i++){
        dpT[++t] = dp[ V[x][i] ];
        AT[t] = A[ V[x][i] ];
    }

    for(int j, i=0; i<=t; i++)
        for(j=0; j<=A[x]; j++)
            M[i][j] = -1;
            
    dp[x] = g(1,A[x]);
}

int n,i,x;
signed main(){
    cin >> n;
    for(i=2;i<=n;i++){
        cin >> x;
        V[x].pb(i);
    }
    for(i=1;i<=n;i++)
        cin >> A[i];
    
    f(1);
    puts(dp[1] < mod ? "POSSIBLE" : "IMPOSSIBLE");
    return 0;
}