#include <bits/stdc++.h>
using namespace std;
int p[1010], a[1010];
int w[1010];
vector<int> cd[1010];
int dp[1010], pos[1010];
int sdp[1010];
void dfs(int v) {
  if (cd[v].size() == 0) {
    dp[v] = a[v];
    w[v] = a[v];
    return;
  }
  for (int i = 0; i < cd[v].size(); i++) dfs(cd[v][i]);
  vector<pair<int, int> > V;
  for (int i = 0; i < cd[v].size(); i++) {
    int nt = cd[v][i];
    if (dp[nt] == -1) {
      dp[v] = -1;
      return;
    }
    V.push_back(make_pair(a[nt], dp[nt] - a[nt]));
  }
  vector<int> prv, nw;
  prv.push_back(0);
  for (int i = 0; i < V.size(); i++) {
    for (int j = 0; j < (int)prv.size(); j++) {
      if (prv[j] + V[i].first <= a[v]) nw.push_back(prv[j] + V[i].first);
      if (prv[j] + V[i].second <= a[v]) nw.push_back(prv[j] + V[i].second);
    }
    prv.clear();
    for (int j = 0; j < (int)nw.size(); j++) prv.push_back(nw[j]);
    nw.clear();
  }
  if (prv.empty()) {
    dp[v] = -1;
    return;
  }
  int second = 0;
  for (int i = 0; i < cd[v].size(); i++) second += dp[cd[v][i]];
  second += a[v] - prv[prv.size() - 1];
  dp[v] = second;
  return;
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) cd[p[i]].push_back(i);
  dfs(1);
  if (dp[1] >= 0)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
