#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
int f[maxn], n, dp[2][maxn * 5], x[maxn];
vector<int> g[maxn];
void dfs(int u) {
  for (auto v : g[u]) dfs(v);
  memset(dp[0], 0x3f3f, sizeof(dp[0]));
  int cur = 0;
  dp[cur][0] = 0;
  for (auto v : g[u]) {
    cur ^= 1;
    memset(dp[cur], 0x3f3f, sizeof(dp[cur]));
    for (int j = 0; j <= x[u]; j++) {
      if (j - x[v] >= 0)
        dp[cur][j] = min(dp[cur][j], dp[cur ^ 1][j - x[v]] + f[v]);
      if (j - f[v] >= 0)
        dp[cur][j] = min(dp[cur][j], dp[cur ^ 1][j - f[v]] + x[v]);
    }
  }
  for (int i = 0; i <= x[u]; i++) f[u] = min(f[u], dp[cur][i]);
}
int main() {
  scanf("%d", &n);
  for (int p, i = 2; i <= n; i++) {
    scanf("%d", &p);
    g[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  memset(f, 0x3f3f, sizeof(f));
  dfs(1);
  if (f[1] < 0x3f3f)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
