#include <bits/stdc++.h>
using namespace std;
class BichromeTree {
  int N;
  vector<int> P, X, S;
  vector<vector<int> > E;
  set<pair<int, int> > col;
  int dfs(vector<int> &A, vector<int> &B, int tar) {
    int n = (int)A.size();
    vector<vector<bool> > dp(N + 1, vector<bool>(5005 + tar, false));
    dp[0][tar] = true;
    bool ok = true;
    for (int i = 1; i <= N && ok; ++i) {
      ok = false;
      for (int j = 0; j <= tar; ++j) {
        dp[i][j] = dp[i - 1][j + A[i - 1]] || dp[i - 1][j + B[i - 1]];
        if (dp[i][j]) ok = true;
      }
    }
    if (!ok) return -1;
    for (int j = 0; j <= tar; ++j)
      if (dp[n][j]) return j;
    return -1;
  }

 public:
  bool solve() {
    cin >> N;
    P = X = S = vector<int>(N, -1);
    E.resize(N);
    for (int i = 1; i < N; ++i) {
      cin >> P[i];
      --P[i];
      E[P[i]].push_back(i);
    }
    for (int i = 0; i < N; ++i) {
      cin >> X[i];
      if (E[i].empty()) {
        S[i] = 0;
        col.insert(pair<int, int>(0, i));
      }
    }
    while (!col.empty()) {
      int l = col.begin()->first, j = P[col.begin()->second], sum = 0;
      if (j == -1) return true;
      vector<int> A, B;
      for (auto k : E[j]) {
        col.erase(pair<int, int>(l, k));
        A.push_back(X[k]);
        B.push_back(S[k]);
        sum += X[k] + S[k];
      }
      S[j] = dfs(A, B, X[j]);
      if (S[j] == -1) return false;
      S[j] += sum - X[j];
      col.insert(pair<int, int>(l + 1, j));
    }
    return true;
  }
};
int main() {
  if (BichromeTree().solve())
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
