#include <algorithm>
#include <cstdio>
#include <iostream>
#include <set>
#include <utility>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <unordered_map>
#include <map>
#include <bitset>
#include <string>
#include <cstring>

#define pb push_back
#define mp make_pair
#define l(x) x << 1
#define r(x) x << 1 | 1
#define scan(x) do {while((x=getchar())<'0') ; for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0') ; } while(0)
char _;
#define x first
#define y second

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<float, float> pff;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;

int N, x[1005], u, dp1[1005], dp2[1005][5005];
vector<int> adj[1005];
bool v = 1;

int go2(int i, int j, int k) {
    if (adj[i].size() <= j) {
        return 0;
    }
    u = adj[i][j];
    if (dp2[u][k] != -1) {
        return dp2[u][k];
    }

    int ret = 1 << 25;
    if (k - dp1[u] >= 0) {
        ret = min(ret, go2(i, j + 1, k - dp1[u]) + x[u]);
    }
    if (k - x[u] >= 0) {
        ret = min(ret, go2(i, j + 1, k - x[u]) + dp1[u]);
    }
    return dp2[u][k] = ret;
}

void go1(int i) {
    if (adj[i].empty()) {
        dp[i] = 0;
        return;
    }
    for (int j = 0; j < adj[i].size(); j++) {
        go1(adj[i][j]);
    }
    int ret = go2(i, 0, x[i]);
    v &= ret < 1 << 25;
    dp1[i] = ret;
}

int main() {
    scanf("%d", &N);
    for (int i = 2; i <= N; i++) {
        scanf("%d", &u);
        adj[u].pb(i);
    }
    for (int i = 1; i <= N; i++) {
        scanf("%d", &x[i]);
    }
    memset(dp1, -1, sizeof dp1);
    memset(dp2, -1, sizeof dp2);
    go1(1);
    printf("%s\n", dp1[1] < 1 << 25 ? "POSSIBLE" : "IMPOSSIBLE");
}
