#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') X = X * 10 + c - '0', c = getchar();
  return X * w;
}
const int N = 1000 + 10, V = 5000 + 10;
const int inf = 0x3f3f3f3f;
int n, X[N];
struct edge {
  int v, nxt;
} e[N];
int head[N];
inline void addEdge(int u, int v) {
  static int cnt = 0;
  e[++cnt] = (edge){v, head[u]}, head[u] = cnt;
}
int f[N], dp[V], tmp[V];
inline void dfs(int u) {
  f[u] = inf;
  memset(dp, inf, sizeof(dp));
  dp[0] = 0;
  for (register int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].v;
    dfs(v);
    for (register int j = X[u]; ~j; --j) tmp[j] = 0x3f3f3f3f;
    for (register int j = X[u]; ~j; --j) {
      if (j >= X[v]) tmp[j] = min(tmp[j], dp[j - X[v]] + f[v]);
      if (j >= f[v]) tmp[j] = min(tmp[j], dp[j - f[v]] + X[v]);
    }
    for (register int j = X[u]; ~j; --j) dp[j] = tmp[j];
  }
  for (register int i = X[u]; ~i; --i) f[u] = min(f[u], dp[i]);
}
int main() {
  n = read();
  for (register int i = 2; i <= n; ++i) addEdge(read(), i);
  for (register int i = 1; i <= n; ++i) X[i] = read();
  dfs(1);
  puts(f[1] < inf ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
