#include <bits/stdc++.h>
using namespace std;
int n;
int p[2001];
int x[2001];
int sum[2001];
int mini[2001];
int maxi[2001];
vector<int> G[1001];
vector<int> dp[1001][5001];
int dfs(int v) {
  int res = x[v];
  for (int j = 0; j <= 5000; j++) {
    dp[v][j].push_back(1000000);
  }
  for (int i = 0; i < G[v].size(); i++) {
    res += dfs(G[v][i]);
    for (int j = 0; j <= 5000; j++) {
      dp[v][j].push_back(1000000);
    }
  }
  sum[v] = res;
  return res;
}
bool dfs2(int v) {
  if (G[v].size() == 0) {
    mini[v] = 0;
    maxi[v] = 0;
    return true;
  }
  dp[v][0][0] = 0;
  for (int i = 0; i < G[v].size(); i++) {
    if (!dfs2(G[v][i])) return false;
    for (int j = 0; j <= x[v]; j++) {
      if (j + x[G[v][i]] <= x[v]) {
        dp[v][j + x[G[v][i]]][i + 1] =
            min(dp[v][j + x[G[v][i]]][i + 1], dp[v][j][i] + mini[G[v][i]]);
      }
      if (j + mini[G[v][i]] <= x[v])
        dp[v][j + mini[G[v][i]]][i + 1] =
            min(dp[v][j + mini[G[v][i]]][i + 1], dp[v][j][i] + x[G[v][i]]);
    }
  }
  mini[v] = 114514;
  for (int i = 0; i <= x[v]; i++) {
    mini[v] = min(mini[v], dp[v][i][G[v].size()]);
    if (dp[v][i][G[v].size()] <= x[v]) {
      mini[v] = min(mini[v], i);
    }
  }
  if (mini[v] == 114514) return false;
  return true;
}
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d", &p[i]);
    p[i]--;
    G[p[i]].push_back(i + 1);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  dfs(0);
  printf("%s\n", dfs2(0) ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
