#include <bits/stdc++.h>
const long long MAXN = 1000;
long long n, edge;
long long X[MAXN | 1], fst[MAXN | 1];
long long sum[MAXN | 1], dp[MAXN | 1][5001];
struct Edge {
  long long to, nxt;
  Edge() : to(0), nxt(0) {}
  Edge(long long a, long long b) : to(b), nxt(fst[a]) {}
} e[MAXN];
inline long long read() {
  register long long x = 0;
  register char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
inline void addEdge(long long a, long long b) {
  e[++edge] = Edge(a, b);
  fst[a] = edge;
}
void DP(long long x) {
  long long size = 0;
  for (long long k = fst[x]; k; k = e[k].nxt) {
    long long to = e[k].to;
    DP(to);
    sum[x] += sum[to];
    ++size;
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (long long i = 1, k = fst[x]; k; k = e[k].nxt, ++i) {
    long long to = e[k].to;
    for (long long j = 0; j <= X[x]; ++j) {
      if (j >= X[to]) dp[i][j] |= dp[i - 1][j - X[to]];
      if (j >= sum[to] - X[to]) dp[i][j] += dp[i - 1][j - sum[to] + X[to]];
    }
  }
  bool flag = false;
  for (long long i = X[x]; i >= 0; --i) {
    if (dp[size][i]) {
      flag = true;
      sum[x] += X[x] - i;
      break;
    }
  }
  if (!flag) {
    puts("IMPOSSIBLE");
    exit(0);
  }
}
signed main() {
  n = read();
  for (long long i = 2; i <= n; ++i) addEdge(read(), i);
  for (long long i = 1; i <= n; ++i) X[i] = read();
  DP(1);
  puts("POSSIBLE");
  return 0;
}
