#include <iostream>

using namespace std;
int n, p[1007], x[1007], dp[1007][5007], t, fa, lim, odp;

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    cin >> n;
    for (int i = 2; i <= n; i++) cin >> p[i];
    for (int i = 1; i <= n; i++) cin >> x[i];

    for (int i = n; i > 0; i--) {
        fa = p[i], lim = x[i];
        for (int j = x[fa]; j >= 0; j--) {
            odp = dp[fa][j], dp[fa][j] = (int) 1e5;
            if (lim <= j)
                dp[fa][j] = (lim == 0 ? odp : dp[fa][j - lim]) + dp[i][lim];

            if (dp[i][lim] <= j) {
                t = (dp[i][lim] == 0 ? odp : dp[fa][j - dp[i][lim]]) + lim;
                if (dp[fa][j] > t) dp[fa][j] = t;
            }
        }
    }
    cout << (dp[1][x[1]] < (int) 1e5 ? "POSSIBLE" : "IMPOSSIBLE");
    return 0;
}