#include <bits/stdc++.h>
using namespace std;
int mi[1005];
int M = 0, fst[666666], vb[666666], nxt[666666];
void ad_de(int a, int b) {
  ++M;
  nxt[M] = fst[a];
  fst[a] = M;
  vb[M] = b;
}
void adde(int a, int b) {
  ad_de(a, b);
  ad_de(b, a);
}
int x[666666], rs[666666], rt[666666];
void dfs(int x) {
  for (int j = 0; j <= ::x[x]; ++j) rs[j] = 1e9;
  rs[0] = 0;
  for (int e = fst[x], b = vb[e]; e; e = nxt[e], b = vb[e]) {
    dfs(b);
    for (int j = 0; j <= ::x[x]; ++j) rt[j] = 1e9;
    for (int j = ::x[x]; j >= 0; --j) {
      if (j + ::x[b] <= ::x[x])
        rt[j + ::x[b]] = min(rt[j + ::x[b]], rs[j] + mi[b]);
      if (j + mi[b] <= ::x[x])
        rt[j + mi[b]] = min(rt[j + mi[b]], rs[j] + ::x[b]);
    }
    for (int j = 0; j <= ::x[x]; ++j) rs[j] = rt[j];
  }
  int mi = 1e9;
  for (int j = ::x[x]; j >= 0; --j) mi = min(mi, rs[j]);
  ::mi[x] = mi;
}
int n;
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    int p;
    scanf("%d", &p);
    ad_de(p, i);
  }
  for (int i = 1; i <= n; ++i) scanf("%d", x + i);
  dfs(1);
  if (mi[1] < 1e8)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
}
