#include <bits/stdc++.h>
using namespace std;
template <class T>
bool cmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool cmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int N = 1234;
const int X = 5005;
const int INF = 1e9;
int n;
int pv[N];
int val[N];
int dp[N][X], f[N];
int tmp[X * 2];
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) scanf("%d", pv + i);
  for (int i = 1; i <= n; i++) scanf("%d", val + i);
  for (int i = 1; i <= n; i++) fill(dp[i] + 1, dp[i] + X, INF);
  for (int u = n; u >= 1; u--) {
    f[u] = *min_element(dp[u], dp[u] + val[u] + 1);
    if (f[u] >= INF) break;
    assert(f[u] < X);
    int p = pv[u];
    fill(tmp, tmp + 2 * X, INF);
    for (int x = X - 1; x >= 0; x--) {
      cmin(tmp[x + val[u]], dp[p][x] + f[u]);
      cmin(tmp[x + f[u]], dp[p][x] + val[u]);
    }
    copy(tmp, tmp + X, dp[p]);
  }
  puts(f[1] < INF ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
