#include <bits/stdc++.h>
using namespace std;
int n;
int f[1010];
struct edge {
  int to, nxt;
} e[1010 << 1];
int edgenum = 0;
int lin[1010] = {0};
void add(int a, int b) {
  ++edgenum;
  e[edgenum].to = b;
  e[edgenum].nxt = lin[a];
  lin[a] = edgenum;
  ++edgenum;
  e[edgenum].to = a;
  e[edgenum].nxt = lin[b];
  lin[b] = edgenum;
  return;
}
int x[1010];
int g[2][1010 * 5];
int fa[1010];
void dp(int k) {
  for (int i = lin[k]; i != 0; i = e[i].nxt) {
    if (fa[k] == e[i].to) continue;
    dp(e[i].to);
  }
  memset(g[0], 0x3f, sizeof(g[0]));
  int cur = 0;
  g[cur][0] = 0;
  for (int i = lin[k]; i != 0; i = e[i].nxt) {
    if (fa[k] == e[i].to) continue;
    cur = cur ^ 1;
    memset(g[cur], 0x3f, sizeof(g[cur]));
    for (int j = 0; j <= x[k]; ++j) {
      if (j >= f[e[i].to])
        g[cur][j] = min(g[cur][j], g[cur ^ 1][j - f[e[i].to]] + x[e[i].to]);
      if (j >= x[e[i].to])
        g[cur][j] = min(g[cur][j], g[cur ^ 1][j - x[e[i].to]] + f[e[i].to]);
    }
  }
  for (int i = 0; i <= x[k]; ++i) {
    f[k] = min(f[k], g[cur][i]);
  }
  return;
}
int main() {
  scanf("%d", &n);
  int a;
  for (int i = 2; i <= n; ++i) {
    scanf("%d", &a);
    add(a, i);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x[i]);
  }
  memset(f, 0x3f, sizeof(f));
  dp(1);
  if (f[1] < 0x3f3f3f3f)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
