#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10, M = 5e3 + 10, inf = 1 << 28;
int n, par[N], x[N], q[N], dp[N][2], f[N], g[N];
vector<int> G[N];
void Update(int &x, int d) { x = min(x, d); }
int main() {
  cin >> n;
  for (int i = 2; i < (n + 1); ++i) cin >> par[i], G[par[i]].push_back(i);
  for (int i = 1; i < (n + 1); ++i) cin >> x[i];
  int _ = 0;
  q[_++] = 1;
  for (int i = 0; i < (_); ++i)
    for (auto e : G[q[i]]) q[_++] = e;
  for (int ii = (_)-1; ii >= (0); --ii) {
    int i = q[ii];
    for (int j = 0; j < (x[i] + 1); ++j) f[j] = inf;
    f[0] = 0;
    for (auto e : G[i]) {
      for (int j = 0; j < (x[i] + 1); ++j) g[j] = inf;
      for (int j = (x[i] + 1) - 1; j >= (0); --j)
        if (j - x[e] >= 0) Update(g[j], f[j - x[e]] + dp[e][0]);
      for (int j = (x[i] + 1) - 1; j >= (0); --j)
        if (j - dp[e][1] >= 0) Update(g[j], f[j - dp[e][1]] + x[e]);
      for (int j = 0; j < (x[i] + 1); ++j) f[j] = g[j];
    }
    dp[i][0] = inf;
    for (int j = 0; j < (x[i] + 1); ++j) Update(dp[i][0], f[j]);
    for (int j = 0; j < (x[i] + 1); ++j) f[j] = inf;
    f[0] = 0;
    for (auto e : G[i]) {
      for (int j = 0; j < (x[i] + 1); ++j) g[j] = inf;
      for (int j = (x[i] + 1) - 1; j >= (0); --j)
        if (j - x[e] >= 0) Update(g[j], f[j - x[e]] + dp[e][1]);
      for (int j = (x[i] + 1) - 1; j >= (0); --j)
        if (j - dp[e][0] >= 0) Update(g[j], f[j - dp[e][0]] + x[e]);
      for (int j = 0; j < (x[i] + 1); ++j) f[j] = g[j];
    }
    dp[i][1] = inf;
    for (int j = 0; j < (x[i] + 1); ++j) Update(dp[i][1], f[j]);
  }
  puts(min(dp[1][0], dp[1][1]) != inf ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
