#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;
const int MAXX = 5e3 + 10;
int n;
vector<int> g[MAXN];
int X[MAXN];
bool read() {
  if (scanf("%d", &n) < 1) {
    return 0;
  }
  for (int i = 0; i < int(n); ++i) {
    g[i].clear();
  }
  for (int i = 1; i < n; ++i) {
    int p;
    scanf("%d", &p);
    --p;
    g[p].push_back(i);
  }
  for (int i = 0; i < int(n); ++i) {
    scanf("%d", &X[i]);
  }
  return 1;
}
const int INF = 1e9;
int dp2[MAXN][MAXX];
int dp[MAXN];
int cur_dp[MAXX];
void remin(int& x, int y) {
  if (x > y) {
    x = y;
  }
}
void dfs(int v) {
  for (int to : g[v]) {
    dfs(to);
  }
  dp[v] = INF;
  {
    int s = 0;
    for (int to : g[v]) {
      s += dp[to];
    }
    if (s <= X[v]) {
      remin(dp[v], X[v]);
    }
  }
  for (int x = 0; x < int(MAXX); ++x) {
    cur_dp[x] = INF;
  }
  cur_dp[0] = 0;
  for (int to : g[v]) {
    static int ndp[MAXX];
    for (int x = 0; x < int(MAXX); ++x) {
      ndp[x] = INF;
    }
    vector<int> curs;
    for (int cur = 0; cur < int(MAXX); ++cur) {
      if (dp2[to][cur] < INF) {
        curs.push_back(cur);
      }
    }
    for (int was = 0; was < int(MAXX); ++was) {
      if (cur_dp[was] >= INF) {
        continue;
      }
      for (int cur : curs) {
        const int dp_son = dp2[to][cur];
        assert(dp_son < INF);
        if (was + cur < MAXX) {
          remin(ndp[was + cur], cur_dp[was] + dp_son);
        }
        if (was + dp_son < MAXX) {
          remin(ndp[was + dp_son], cur_dp[was] + cur);
        }
      }
    }
    memcpy(cur_dp, ndp, sizeof cur_dp);
  }
  for (int sons = 0; sons < int(X[v] + 1); ++sons) {
    remin(dp[v], cur_dp[sons]);
  }
  for (int s = 0; s < int(MAXX); ++s) {
    dp2[v][s] = INF;
  }
  for (int sons = 0; sons < int(X[v] + 1); ++sons) {
    remin(dp2[v][X[v]], min(X[v], cur_dp[sons]));
  }
}
bool solve() {
  const int r = 0;
  dfs(r);
  if (dp[r] >= INF) {
    return 0;
  }
  return 1;
}
int main() {
  while (read()) {
    puts(solve() ? "POSSIBLE" : "IMPOSSIBLE");
  }
  return 0;
}
