#include <bits/stdc++.h>
using namespace std;
int x[5001];
int n;
pair<int, int> dp[1001];
vector<int> e[1001];
bool juu;
void solve(int y) {
  if (juu) return;
  int sum = 0;
  bitset<5001> p;
  p[0] = 1;
  for (int c : e[y]) {
    pair<int, int> a = dp[c];
    p = (p << a.first) | (p << a.second);
    sum += (a.first + a.second);
  }
  for (int i = x[y]; i >= 0; --i)
    if (p[i]) {
      dp[y] = {x[y], sum - i};
      return;
    }
  juu = true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  juu = false;
  int c;
  for (int i = 2; i <= n; ++i) {
    cin >> c;
    e[c].push_back(i);
  }
  for (int i = 1; i <= n; ++i) cin >> x[i];
  for (int i = n; i; --i) solve(i);
  if (juu) cout << "IMPOSSIBLE" << endl;
  cout << "POSSIBLE" << endl;
  return 0;
}
