#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

typedef long long ll;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound


int x[5001];
int n;
pair<int,int> dp[1001];
vector<int> e[1001];
bool juu;
void solve(int y)
{
    int sum = 0;
    bitset<5001> p;
    p[0] = 1;
    for (int c: e[y])
    {
        pair<int,int> a = dp[c];
        p = (p<<a.f)|(p<<a.s);
        sum += (a.f+a.s);
    }
    for (int i = x[y]; i >= 0; --i)
        if (p[i])
        {
            dp[y] = {x[y],sum-i};
            return;
        }
    juu=true;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    int c;
    for(int i=2;i<=n; ++i)
    {
        cin >> c;
        e[c].push_back(i);
    }
    for(int i=1; i<=n; ++i) cin >> x[i];
    for(int i=n; i; --i) solve(i);
    if(juu) cout<<"IMPOSSIBLE"<<endl;
    cout << "POSSIBLE"<<endl;
}
