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

const int maxn = 1010;
int n, x[maxn], fa[maxn];
long long all[maxn];
bitset<5010> f[maxn];
bool chk[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 2; i <= n; i++) {
        scanf("%d", &fa[i]), chk[fa[i]] = 1;
    }
    for (int i = 1; i <= n; i++) {
        scanf("%d", &x[i]), f[i].set(0);
    }
    for (int i = n; i; i--) {
        if (chk[i]) {
            int t = -1;
            for (int j = x[i]; ~j; j--) {
                if (f[i].test(j)) { t = j; break; }
            }
            if (!~t) printf("IMPOSSIBLE\n"), exit(0);
            f[fa[i]] = (f[fa[i]] << x[i]) | (f[fa[i]] << (all[i] - t));
            all[fa[i]] += all[i] - t + x[i];
        } else {
            f[fa[i]] |= (f[fa[i]] << x[i]);
            all[fa[i]] += x[i];
        }
    }
    printf("POSSIBLE\n");
    return 0;
}