#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAXX = 5000;
vector<int> adjList[MAXN + 1];
int x[MAXN + 1];
int weights[MAXN + 1][2];
bool dp[MAXX + 1];
bool solve(int v, int p) {
  int totalSum = 0;
  for (int adj : adjList[v]) {
    if (adj != p) {
      if (!solve(adj, v)) return false;
      totalSum += weights[adj][0] + weights[adj][1];
      fill(dp, dp + x[v] + 1, false);
      dp[0] = true;
      for (int i = x[v]; i >= 0; i--) {
        if (dp[i]) {
          dp[i] = false;
          for (int j = 0; j < 2; j++) {
            if (i + weights[adj][j] <= x[v]) {
              dp[i + weights[adj][j]] = true;
            }
          }
        }
      }
    }
  }
  int best = -1;
  for (int i = 0; i <= x[v]; i++) {
    if (dp[i]) best = i;
  }
  if (best == -1) return false;
  weights[v][0] = x[v];
  weights[v][1] = totalSum + best;
  if (weights[v][0] > weights[v][1]) swap(weights[v][0], weights[v][1]);
  return true;
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    adjList[i].push_back(p);
    adjList[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> x[i];
  if (solve(1, 1))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
