#include <bits/stdc++.h>
using namespace std;
vector<int> x, a;
vector<list<int>> child;
bool dfs(int n) {
  int ruiseki = 0;
  int si = child[n].size();
  bool ans = true;
  vector<int> wei(si);
  int count = 0, weitotal = 0;
  for (auto i : child[n]) {
    ans &= dfs(i);
    ruiseki += ((x[i]) < (a[i]) ? (x[i]) : (a[i]));
    wei[count] = ((x[i]) > (a[i]) ? (x[i]) : (a[i])) -
                 ((x[i]) < (a[i]) ? (x[i]) : (a[i]));
    weitotal += wei[count];
    count++;
  }
  if (ruiseki > x[n]) {
    return false;
  }
  vector<vector<bool>> dp(si + 1, vector<bool>(x[n] - ruiseki + 1, false));
  for (int i = 0; i <= si; i++) dp[i][0] = true;
  for (int i = 1; i <= si; i++) {
    for (int j = 1; j <= x[n]; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j >= wei[i - 1]) dp[i][j] = dp[i][j] | dp[i - 1][j - wei[i - 1]];
    }
  }
  int ma = 0;
  for (int i = 0; i <= x[n] - ruiseki; i++)
    if (dp[si][i]) ma = i;
  a[n] = weitotal - ma;
  return ans;
}
int main() {
  int n;
  cin >> n;
  x = vector<int>(n);
  a = vector<int>(n, 0);
  child = vector<list<int>>(n, list<int>());
  int p;
  for (int i = 1; i < n; i++) {
    cin >> p;
    child[p - 1].push_back(i);
  }
  for (int i = 0; i < n; i++) cin >> x[i];
  cout << (dfs(0) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
