#include <bits/stdc++.h>
using namespace std;
const long long K = 10001;
vector<vector<long long> > data;
vector<long long> money;
bool dp[K], dp1[K], res;
long long dfs(long long vertex) {
  for (long long i = 0; i < K; i++) {
    dp[i] = false;
    dp1[i] = false;
  }
  dp[0] = true;
  long long summ = 0, sm = 0;
  vector<pair<long long, long long> > p;
  for (long long i = 0; i < data[vertex].size(); i++) {
    long long to = data[vertex][i];
    long long rest = dfs(to);
    if (!res) {
      return 0;
    }
    summ += money[to] + rest;
    sm += min(rest, money[to]);
    p.push_back(make_pair(money[to], rest));
  }
  if (sm > money[vertex]) {
    res = false;
    return 0;
  }
  for (long long i = 0; i < p.size(); i++) {
    for (long long j = 0; j < K; j++) {
      if (!dp[j]) continue;
      if (p[i].first + j < K) dp1[p[i].first + j] = true;
      if (p[i].second + j < K) dp1[p[i].second + j] = true;
    }
    for (long long j = 0; j < K; j++) {
      dp[j] = dp1[j];
      dp1[j] = false;
    }
  }
  long long can;
  for (long long i = money[vertex]; i >= 0; i--) {
    if (dp[i]) {
      can = i;
      break;
    }
  }
  summ += money[vertex] - can;
  return summ - money[vertex];
}
int32_t main() {
  long long n, ai;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    vector<long long> help;
    data.push_back(help);
  }
  for (long long i = 0; i < n - 1; i++) {
    cin >> ai;
    data[ai - 1].push_back(i + 1);
  }
  for (long long i = 0; i < n; i++) {
    cin >> ai;
    money.push_back(ai);
  }
  res = true;
  dfs(0);
  if (res) {
    cout << "POSSIBLE" << endl;
  } else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
