#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
int i, j, m, n, p, k, F[1005], G[1005], T[1005][5005], R[1005], P[1005][5005],
    fa[1005], a[1005];
int main() {
  scanf("%d", &n);
  for (i = 2; i <= n; ++i) {
    scanf("%d", &fa[i]);
  }
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (i = n; i >= 1; --i) {
    int f = inf;
    for (j = 0; j <= a[i]; ++j) f = min(f, T[i][j]);
    F[i] = f;
    f = inf;
    for (j = 0; j <= a[i]; ++j) f = min(f, P[i][j]);
    G[i] = f;
    if (F[i] == inf && G[i] == inf) break;
    memset(R, 60, sizeof(R));
    int p = fa[i];
    for (j = a[p]; j - a[i] >= 0; --j) R[j] = min(R[j], T[p][j - a[i]] + F[i]);
    for (j = a[p]; j - G[i] >= 0; --j) R[j] = min(R[j], T[p][j - G[i]] + a[i]);
    for (j = 0; j <= a[p]; ++j) T[p][j] = R[j];
    memset(R, 60, sizeof(R));
    for (j = a[p]; j - F[i] >= 0; --j) R[j] = min(R[j], P[p][j - F[i]] + a[i]);
    for (j = a[p]; j - a[i] >= 0; --j) R[j] = min(R[j], P[p][j - a[i]] + G[i]);
    for (j = 0; j <= a[p]; ++j) P[p][j] = R[j];
  }
  puts("POSSIBLE");
}
