#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch - '0' < 0 || ch - '0' > 9) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch - '0' >= 0 && ch - '0' <= 9) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n;
int w[1010], f[1010];
int g[2][5050];
int head[1010], nxt[1010], to[1010], tot;
void add(int u, int v) {
  tot++;
  nxt[tot] = head[u];
  head[u] = tot;
  to[tot] = v;
}
void dfs(int x) {
  for (int i = head[x]; i; i = nxt[i]) dfs(to[i]);
  int cur = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j <= w[x]; j++) g[i][j] = 2000000007;
  g[cur][0] = 0;
  for (int i = head[x]; i; i = nxt[i]) {
    for (int j = 0; j <= w[x]; j++) {
      if (j >= w[to[i]])
        g[cur ^ 1][j] = min(g[cur ^ 1][j], g[cur][j - w[to[i]]] + f[to[i]]);
      if (j >= f[to[i]])
        g[cur ^ 1][j] = min(g[cur ^ 1][j], g[cur][j - f[to[i]] + w[to[i]]]);
    }
    for (int j = 0; j <= w[x]; j++) g[cur][j] = 2000000007;
    cur ^= 1;
  }
  int now = 2000000007;
  for (int i = 0; i <= w[x]; i++) now = min(now, g[cur][i]);
  if (now == 2000000007) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  f[x] = now;
}
int main() {
  n = read();
  for (int i = 2; i <= n; i++) add(read(), i);
  for (int i = 1; i <= n; i++) w[i] = read();
  dfs(1);
  puts("POSSIBLE");
  return 0;
}
