#include <bits/stdc++.h>
int lst[1005], to[1005], pre[1005], tot;
int dp[1005][10005], tmp[5005], sum[1005], mn[5005];
inline void add_edge(int u, int v) {
  to[tot] = v;
  pre[tot] = lst[u];
  lst[u] = tot++;
}
void dfs(int u) {
  dp[u][0] = 0;
  for (int i = lst[u]; ~i; i = pre[i]) {
    dfs(to[i]);
    memset(tmp, 0x3f, sizeof(tmp));
    for (int j = 0; j <= sum[u]; j++) {
      (tmp[j + sum[to[i]]]) =
          std::min(tmp[j + sum[to[i]]], dp[u][j] + mn[to[i]]);
      if (mn[to[i]] < 1e9)
        (tmp[j + mn[to[i]]]) =
            std::min(tmp[j + mn[to[i]]], dp[u][j] + sum[to[i]]);
    }
    memcpy(dp[u], tmp, sizeof(tmp));
  }
  mn[u] = 1e9;
  for (int i = 0; i <= sum[u]; i++) (mn[u]) = std::min(mn[u], dp[u][i]);
}
int main() {
  memset(lst, -1, sizeof(lst));
  memset(dp, 0x3f, sizeof(dp));
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x;
    scanf("%d", &x);
    add_edge(--x, i);
  }
  for (int i = 0; i < n; i++) scanf("%d", sum + i);
  dfs(0);
  puts(mn[0] < 1e9 ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
