#include <iostream>

using namespace std;
int n, p[1007], x[1007], dp[1007][5007], f[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];
            if (lim <= j)
                dp[fa][j] = dp[fa][j - lim] + dp[i][lim];
            else
                dp[fa][j] = (int) 1e7;

            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) 1e7 ? "POSSIBLE" : "IMPOSSIBLE");
    return 0;
}