#include <bits/stdc++.h>
namespace gg {
const int N = 1050, M = 30050;
int begin[N], next[N], to[N];
int w[N], f[N];
int n, e;
void add(int x, int y) {
  to[++e] = y;
  next[e] = begin[x];
  begin[x] = e;
}
void initialize() {
  scanf("%d", &n);
  for (int i = 2, x; i <= n; i++) scanf("%d", &x), add(x, i);
  for (int i = 1; i <= n; i++) scanf("%d", w + i);
}
bool ex[M];
bool dfs(int p) {
  int sum = 0;
  f[p] = 0;
  for (int i = begin[p], q; i; i = next[i]) {
    if (!dfs(q = to[i])) return 0;
    if (w[q] < f[q]) std::swap(w[q], f[q]);
    sum += w[q], f[p] += f[q];
  }
  if (sum <= w[p]) return 1;
  if (f[p] > w[p]) return 0;
  memset(ex, 0, sizeof(ex));
  ex[0] = 1;
  for (int i = begin[p], q; i; i = next[i]) {
    q = to[i];
    int x = w[q] - f[q];
    for (int j = M - 1; j >= x; j--) ex[j] |= ex[j - x];
  }
  for (int i = sum - w[p]; i < M; i++)
    if (ex[i]) {
      f[p] += i;
      return 1;
    }
  return 0;
}
void solve() {
  initialize();
  printf("%s\n", dfs(1) ? "POSSIBLE" : "IMPOSSIBLE");
}
}  // namespace gg
int main() {
  gg::solve();
  return 0;
}
