#include <bits/stdc++.h>
using namespace std;
int n, p[5100], x[5100], dp[5100];
vector<int> graph[5100];
int ldp[15000];
int lodp[15000];
void dfs(int v) {
  for (int i = 0; i < graph[v].size(); i++) dfs(graph[v][i]);
  for (int i = 0; i <= 5001; i++) ldp[i] = 5001;
  int sdp = 0, sx = 0, smin = 0;
  for (int i = 0; i < graph[v].size(); i++) {
    int u = graph[v][i];
    sdp += dp[u];
    sx += x[u];
    smin += min(dp[u], x[u]);
  }
  if (smin > x[v]) {
    cout << "IMPOSSIBLE\n";
    exit(0);
  }
  for (int i = 0; i <= 5000; i++) ldp[i] = 5001;
  ldp[smin] = smin;
  for (int i = 0; i < graph[v].size(); i++) {
    int u = graph[v][i];
    int k = abs(dp[u] - x[u]);
    for (int j = smin; j <= 5000; j++) lodp[j] = 5001;
    for (int j = smin + k; j <= 5000; j++)
      lodp[j] = min(ldp[j] + k, ldp[j - k]);
    for (int j = smin; j <= 5000; j++) ldp[j] = lodp[j];
  }
  int c = 5001;
  for (int i = 0; i <= x[v]; i++) c = min(c, ldp[i]);
  for (int i = 0; i <= 5000; i++)
    if (ldp[i] <= x[v]) c = min(c, i);
  dp[v] = c;
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
    graph[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> x[i];
  dfs(1);
  cout << "POSSIBLE";
}
