#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
 
using namespace std;
using namespace boost;

int64_t exec(const vector<vector<int>>& children, const vector<int64_t>& x, int root) {
  if (children[root].empty()) {
    return 0L;
  }

  constexpr auto kMax = 1000 * 5000;
  unordered_set<int64_t> nums;
  nums.insert(0);
  int64_t total = 0;
  for (auto c : children[root]) {
    auto p = exec(children, x, c);
    if (p < 0) {
      return p;
    }
    unordered_set<int64_t> next;
    for (auto n : nums) {
      next.insert(n + x[c]);
      next.insert(n + p);
    }
    nums.swap(next);
    total += x[c] + p;
  }
  
  for (int64_t i = x[root]; i >= 0; --i) {
    if (nums.count(i) > 0) {
      return total - i;
    }
  }
  
  return -1;
}

main() {
  int n;
  cin >> n;

  vector<vector<int>> children(n);
  for (auto i : irange(1, n)) {
    int parent;
    cin >> parent;
    children[parent].push_back(i);
  }
  
  vector<int64_t> x(n);
  for (auto&& xx : x) {
    cin >> xx;
  }
  
  if (exec(children, x, 0) >= 0) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}