#include <bits/stdc++.h>
using namespace std;
int N;
int P[1010];
int X[1010];
vector<vector<int> > G(1010);
int oth[1010];
int ok;
int vi[5010], vi2[5010];
void dfs(int u) {
  int i;
  int v;
  if (ok == 0) return;
  if (G[u].size() == 0) {
    oth[u] = 0;
    return;
  }
  for (i = 0; i < G[u].size(); i++) {
    v = G[u][i];
    dfs(v);
  }
  v = G[u][0];
  int a1 = X[v], a2 = oth[v];
  if (a1 > a2) swap(a1, a2);
  int a[4];
  for (i = 0; i <= 5005; i++) {
    vi[i] = vi2[i] = -1;
  }
  vi[a2] = a1;
  int tmp1, tmp2;
  for (i = 1; i < G[u].size(); i++) {
    v = G[u][i];
    for (i = 0; i <= 5005; i++) {
      if (vi[i] >= 0) {
        tmp1 = vi[i] + X[v];
        if (tmp1 > 5000) tmp1 = 5001;
        tmp2 = i + oth[v];
        if (tmp2 > 5000) tmp2 = 5001;
        if (tmp1 > tmp2) swap(tmp1, tmp2);
        if (vi2[tmp2] == -1 || vi2[tmp2] > tmp1) vi2[tmp2] = tmp1;
        tmp1 = vi[i] + oth[v];
        if (tmp1 > 5000) tmp1 = 5001;
        tmp2 = i + X[v];
        if (tmp2 > 5000) tmp2 = 5001;
        if (tmp1 > tmp2) swap(tmp1, tmp2);
        if (vi2[tmp2] == -1 || vi2[tmp2] > tmp1) vi2[tmp2] = tmp1;
      }
    }
    for (i = 0; i <= 5005; i++) vi[i] = vi2[i];
  }
  int rx = -1, ro;
  for (i = 0; i <= 5005; i++) {
    if (vi[i] >= 0) {
      a2 = i;
      a1 = vi[i];
      if (a1 > X[u]) {
      } else {
        if (a2 > X[u]) {
          if (rx == -1 || ro > a2) {
            ro = a2;
            rx = X[u];
          }
        } else {
          if (rx == -1 || ro > a1) {
            ro = a1;
            rx = X[u];
          }
        }
      }
    }
  }
  if (rx == -1) {
    ok = 0;
  } else {
    oth[u] = ro;
  }
}
void solve() {
  int i;
  for (i = 1; i < N; i++) {
    G[P[i]].push_back(i);
  }
  ok = 1;
  dfs(0);
  if (ok)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
}
int main() {
  int i;
  scanf("%d", &N);
  for (i = 1; i < N; i++) {
    scanf("%d", &P[i]);
    P[i]--;
  }
  for (i = 0; i < N; i++) scanf("%d", &X[i]);
  solve();
  return 0;
}
