#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
const ll mod = 1e9 + 7;
const int maxn = 1e4 + 10;
int n;
vector<int> g[maxn];
int x[maxn];
vector<pair<int, int>> dp[maxn];
bool dfs(int at) {
  for (int to : g[at]) {
    if (!dfs(to)) return false;
  }
  {
    vector<pair<int, int>> v = {make_pair(0, 0)};
    for (int to : g[at]) {
      vector<pair<int, int>> w;
      for (auto p : v) {
        for (auto q : dp[to]) {
          if (q.first + q.first <= x[at]) {
            w.push_back({p.first + q.first, p.second + q.second});
          }
        }
      }
      swap(v, w);
    }
    set<int> white;
    for (auto p : v) {
      if (p.second > 5000) {
        break;
      }
      white.insert(p.second);
    }
    for (int ww : white) {
      dp[at].push_back(make_pair(x[at], ww));
    }
  }
  {
    vector<pair<int, int>> v = {make_pair(0, 0)};
    for (int to : g[at]) {
      vector<pair<int, int>> w;
      for (auto p : v) {
        for (auto q : dp[to]) {
          if (q.second + p.second <= x[at]) {
            w.push_back({p.first + q.first, p.second + q.second});
          }
        }
      }
      swap(v, w);
    }
    set<int> black;
    for (auto p : v) {
      if (p.second > 5000) {
        break;
      }
      black.insert(p.first);
    }
    for (int bb : black) {
      dp[at].push_back(make_pair(bb, x[at]));
    }
  }
  return !dp[at].empty();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
  }
  bool ok = dfs(1);
  cout << (ok ? "POSSIBLE\n" : "IMPOSSIBLE\n");
  return 0;
}
