#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll N;
vector<vector<ll>> Kids;
vector<ll> X;
const ll MAX_X = 5000;

pair<ll, ll> dfs(ll v) {
  ll sum_total = 0;
  bitset<MAX_X + 1> sums;
  sums[0] = 1;
  for (ll w : Kids[v]) {
    ll sum0, sum1;
    tie(sum0, sum1) = dfs(w);
    if (sum0 < 0) return make_pair(-1, -1);
    sums = (sums << sum0) | (sums << sum1);
    sum_total += sum0 + sum1;
  }
  for (ll sum = X[v]; sum >= 0; --sum) {
    if (sums[sum]) return make_pair(X[v], sum_total - sum);
  }
  return make_pair(-1, -1);
}
int main() {
  cin >> N;
  Kids.resize(N);
  for (ll v = 1; v < N; ++v) {
    ll p;
    cin >> p;
    --p;
    Kids[p].push_back(v);
  }
  X.resize(N);
  for (ll v = 0; v < N; ++v) cin >> X[v];
  cout << (dfs(0).first >= 0 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
