#include <bits/stdc++.h>
using namespace std;
struct jie {
  int l, h;
  int lh;
} a[1005];
vector<int> q[1005];
const int inf = 10000009;
int f = 0;
int dp[5000005], b[1005];
int dfs(int u) {
  int i, j, k, ma = 0, t;
  if (q[u].size()) {
    int sum = 0, s = 0, m;
    for (i = 0; i < q[u].size(); i++) {
      sum += dfs(q[u][i]);
      s += a[q[u][i]].h + a[q[u][i]].h;
    }
    if (sum > b[u]) {
      f = 1;
      return inf;
    }
    m = b[u] - sum;
    for (i = 0; i <= m; i++) {
      dp[i] = 0;
    }
    for (i = 0; i < q[u].size(); i++) {
      k = q[u][i];
      for (j = m; j >= a[k].lh; j--) {
        dp[j] = max(dp[j], dp[j - a[k].lh] + a[k].lh);
      }
    }
    for (i = 0; i <= m; i++) {
      ma = max(ma, dp[i]);
    }
    t = sum + ma;
    s -= t;
    a[u].h = max(s, b[u]);
    a[u].l = min(s, b[u]);
    a[u].lh = a[u].h - a[u].l;
  }
  return a[u].l;
}
int main() {
  int n, x, i;
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    scanf("%d", &x);
    q[x].push_back(i);
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
  }
  for (i = 1; i <= n; i++) {
    if (q[i].size() == 0) {
      a[i].h = a[i].lh = b[i];
      a[i].l = 0;
    }
  }
  dfs(1);
  if (f == 1) {
    printf("IMPOSSIBLE\n");
  } else {
    printf("POSSIBLE\n");
  }
  return 0;
}
