#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int M = 1010;
const int V = 5020;
int f[M][2], g[M][V][2], fi[M * 2], ne[M * 2], la[M], to[M * 2], n, x, y, a[M],
    tot;
void add(int x, int y) {
  to[++tot] = y;
  !fi[x] ? fi[x] = tot : ne[la[x]] = tot;
  la[x] = tot;
}
void dfs(int x, int fa) {
  f[x][0] = f[x][1] = inf;
  for (int i = fi[x]; i; i = ne[i]) {
    int v = to[i];
    if (v == fa) continue;
    dfs(v, x);
  }
  int cnt = 0;
  for (int i = 0; i <= 1; i++) {
    g[0][0][i] = 0;
    for (int j = fi[x]; j; j = ne[j]) {
      int v = to[j];
      if (v == fa) continue;
      ++cnt;
      for (int k = 0; k <= a[x]; k++) g[cnt][k][i] = inf;
      for (int k = 0; k <= a[x]; k++) {
        if (k + a[v] <= a[x])
          g[cnt][k + a[v]][i] =
              min(g[cnt][k + a[v]][i], g[cnt - 1][k][i] + f[v][i ^ 1]);
        if (k + f[v][i ^ 1] <= a[x])
          g[cnt][k + f[v][i ^ 1]][i] =
              min(g[cnt][k + f[v][i ^ 1]][i], g[cnt - 1][k][i] + a[v]);
      }
    }
    for (int j = 0; j <= a[x]; j++) f[x][i] = min(f[x][i], g[cnt][j][i]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &x);
    add(x, i);
    add(i, x);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(1, 0);
  printf(f[1][0] < inf || f[1][1] < inf ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
