#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline int chkmin(T &x, const T &y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline int chkmax(T &x, const T &y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline T read(T &f) {
  f = 0;
  int x = 1;
  char c = getchar();
  while (!isdigit(c)) c = x == '-' ? -1 : 1, c = getchar();
  while (isdigit(c)) (f *= 10) += c & 15, c = getchar();
  return f *= x;
}
using int64 = long long;
using uint64 = unsigned long long;
const int N = 5000 + 5;
int n, A[N];
struct Edge {
  int to;
  Edge *next;
} E[N << 1], *pre[N];
void addedge(int u, int v) {
  static int cnt = 0;
  E[++cnt] = {v, pre[u]}, pre[u] = &E[cnt];
  E[++cnt] = {u, pre[v]}, pre[v] = &E[cnt];
}
int f[N], g[N];
const int INF = 1ll << 30;
void dfs(int u, int fa) {
  for (Edge *i = pre[u]; i; i = i->next) {
    int v = i->to;
    if (v == fa) continue;
    dfs(v, u);
  }
  static int d[N];
  for (int i = (1), ___ = (5000); i <= ___; ++i) d[i] = INF;
  d[0] = 0;
  for (Edge *i = pre[u]; i; i = i->next) {
    int v = i->to;
    if (v == fa) continue;
    for (int x = (f[u]), ___ = (f[v]); x >= ___; --x) {
      chkmin(d[x], d[x - f[v]] + g[v]);
    }
    for (int x = (f[u]), ___ = (g[v]); x >= ___; --x) {
      chkmin(d[x], d[x - g[v]] + f[v]);
    }
  }
  int ret = INF;
  for (int i = (1), ___ = (f[u]); i <= ___; ++i) chkmin(ret, d[i]);
  g[u] = ret;
}
int main() {
  read(n);
  for (int i = (2), ___ = (n); i <= ___; ++i) {
    static int u, v;
    u = i, read(v);
    addedge(u, v);
  }
  for (int i = (1), ___ = (n); i <= ___; ++i) read(f[i]);
  dfs(1, 0);
  puts(g[1] < INF ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
