#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 342307123
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2
#define sq(x)  ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

typedef pair<i64, i64> pii;

vector <int> g[1005] ;
int x[1005] , mn[1005] ;
int dp[5005]  ;

bool dfs(int u)
{
    int i , j , k , l , v ;

    for(i=0 ; i<=5000 ; i++) dp[i]=0 ;
    dp[0] = 1 ;

    int total = 0 ;

    for(i=0 ; i<g[u].size() ; i++)
    {
        v = g[u][i] ;
        bool ret = dfs(v) ;
        if(ret==0) return 0 ;
        int temp[5005] ;
        for(j=0 ; j<=5000 ; j++) temp[i] = 0 ;
        for(j=0 ; j+x[v]<=5000 ; j++) temp[j+x[v]] |= dp[j] ;
        for(j=0 ; j+mn[v]<=5000 ; j++) temp[ j+mn[v] ] |= dp[j] ;
        temp[ x[v] ] =1 ; 
        if( mn[v]<=5000 )temp[ mn[v] ] = 1 ;

        for(j=0 ; j<=5000 ; j++) dp[j] = temp[j] ;

        total += x[v] + mn[v] ;
    }

    for(j=0 ; j<=x[u] ; j++)
    {
        if(  dp[j]==1 )
        {
            mn[u] = total - j ;
     //       printf("%d: %d\n",u,x[u]-j ) ;
            return true ;
        }
    }
    return false ;
}

int main()
{
    int i , j , k , l , m , n ;

    scanf("%d",&n) ;

    FOR(i,2,n)
    {
        scanf("%d",&k) ;
        g[k].pb(i) ;
    }

    FOR(i,1,n) scanf("%d",&x[i]) ;

    bool ret = dfs(1) ;

    if(ret==true) printf("POSSIBLE\n") ;
    else printf("IMPOSSIBLE\n") ;

    return 0 ;
}
