#include <bits/stdc++.h>
using namespace std;
const int mx = 1e3 + 10;
const long long int oo = 1e18;
vector<int> g[mx];
long long int x[mx];
long long int f[2][5000 + 10];
long long int dp[mx];
void dfs(int u) {
  long long int sm = 0;
  for (int v : g[u]) {
    dfs(v);
    sm += dp[v] + x[v];
  }
  if (g[u].empty()) {
    dp[u] = 0;
    return;
  }
  int b = 0;
  memset(f, 0ll, sizeof f);
  for (int s = 0; s <= x[u]; s++) f[b][s] = sm - s;
  for (int v : g[u]) {
    b ^= 1;
    for (int s = 0; s <= x[u]; s++) {
      long long int p = dp[v], q = x[v];
      f[b][s] = oo;
      for (int it = 0; it < 2; it++)
        if (s + p <= x[u]) {
          f[b][s] = min(f[b][s], f[b ^ 1][s + p]);
          swap(p, q);
        }
    }
  }
  dp[u] = f[b][0];
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int pi;
    scanf("%d", &pi);
    --pi;
    g[pi].push_back(i);
  }
  for (int i = 0; i < n; i++) scanf("%lld", x + i);
  dfs(0);
  if (dp[0] >= oo)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
