#include <bits/stdc++.h>
using namespace std;
vector<int> gr[1919];
bool dp[2][5140];
int x[1919];
string out = "POSSIBLE";
pair<int, int> dfs(int v) {
  if (gr[v].size() == 0) return make_pair(x[v], 0);
  memset(dp, false, sizeof(dp));
  dp[0][0] = true;
  int sum = 0, n = gr[v].size(), ma = -1;
  vector<pair<int, int> > p;
  for (int i = 0; i < n; i++) {
    pair<int, int> complex<double> = dfs(gr[v][i]);
    sum += complex<double>.first + complex<double>.second;
    assert(sum <= 5000 * 1000);
    p.push_back(complex<double>);
  }
  for (int j = 0; j < n; j++) {
    int now = j % 2, ne = 1 - now;
    memset(dp[ne], false, sizeof(dp[ne]));
    for (int i = 0; i < x[v] + 1; i++) {
      if (!dp[now][i]) continue;
      if (i + p[j].first <= x[v]) dp[ne][i + p[j].first] = true;
      if (i + p[j].second <= x[v]) dp[ne][i + p[j].second] = true;
    }
  }
  for (int i = 0; i < x[v] + 1; i++) {
    if (dp[n % 2][i]) ma = i;
  }
  if (ma < 0) {
    out = "IMPOSSIBLE";
    return make_pair(0, 0);
  }
  return make_pair(x[v], sum - ma);
}
int main() {
  int n, p;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> p;
    p--;
    gr[p].push_back(i + 1);
  }
  for (int i = 0; i < n; i++) cin >> x[i];
  dfs(0);
  cout << out << endl;
}
