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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

vector<int> g[100010]; int x[100010],y[100010]={};
bool dfs(int v){
    bitset<5010> dp; dp[0]=1; ll sum=0;
    for(int to:g[v]){
        if(!dfs(to))return 0;
        dp=(dp<<x[to])|(dp<<y[to]);
        sum+=x[to]+y[to];
    }
    rrep(i,x[v],-1)if(dp[i]){
        y[v]=sum-i; return 1;
    }return 0;
}

int main(){
    int n; scanf("%d",&n);
    rep(i,1,n){
        int p; scanf("%d",&p); p--;
        g[p].push_back(i);
    }
    rep(i,0,n)scanf("%d",&x[i]);
    printf(dfs(0)?"POSSIBLE\n":"IMPOSSIBLE\n");
    return 0;
}