#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 3, M = 5e3 + 2;
vector<int> g[N];
int X[N], ok = 1;
int dp[N];
void dfs(int v) {
  int sum = 0;
  for (auto it : g[v]) dfs(it), sum += dp[it] + X[it];
  bool tmp[M];
  memset(tmp, 0, sizeof(tmp));
  if (g[v].size() == 0) tmp[0] = 1;
  for (int it : g[v]) {
    for (int i = M - 1; i >= 0; i--) {
      if (tmp[i]) {
        if (i + dp[it] < M) tmp[i + dp[it]] |= tmp[i];
        if (i + X[it] < M) tmp[i + X[it]] |= tmp[i];
      }
    }
    if (dp[it] < M) tmp[dp[it]] = 1;
    tmp[X[it]] = 1;
  }
  for (int i = X[v]; i >= 0; i--) {
    if (tmp[i]) {
      dp[v] = sum - i;
      if (dp[v] < 0) abort();
      return;
    }
  }
  ok = 0;
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    g[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &X[i]);
  dfs(1);
  puts(ok ? "POSSIBLE" : "IMPOSSIBLE");
}
