#include <iostream>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>

using namespace std;

typedef long long ll;

ll n;
ll a[1005], b[1005];
ll d[1005];
vector<ll> ve[1005];
bitset<5005> bs;

int main()
{
    scanf("%lld", &n);
    for(ll i = 2; i <= n; i++)
    {
        scanf("%lld", &a[i]);
        ve[a[i]].push_back(i);
    }
    for(ll i = 1; i <= n; i++)
    {
        scanf("%lld", &b[i]);
    }
    for(ll i = n; i >= 1; i--)
    {
        ll t = b[i];
        bs = 1;
        ll sum = 0;
        ll now = 0;
        for(ll j = 0; j < ve[i].size(); j++)
        {
            t -= min(b[ve[i][j]], d[ve[i][j]]);
            sum += max(b[ve[i][j]], d[ve[i][j]]);
            bs |= (bs << abs(b[ve[i][j]] - d[ve[i][j]]));
        }
        if(t < 0)
        {
            printf("IMPOSSIBLE\n");
            return 0;
        }
        for(ll i = t; i >= 0; i--)
        {
            if(bs[i]) {now = i; break;}
        }
        d[i] = sum - now;
    }
    printf("POSSIBLE\n");
    return 0;
}
