#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int N, X[1001];
vector<int> g[1000];
int dp[1000][5001];
int main() {
  cin >> N;
  for (int i = 1; i < N; i++) {
    int x;
    cin >> x;
    g[--x].emplace_back(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  fill_n(*dp, 1000 * 5001, INF);
  for (int i = N - 1; i >= 0; i--) {
    if (g[i].empty()) {
      dp[i][X[i]] = 0;
      dp[i][0] = X[i];
    } else {
      vector<int> dp2(5001, INF);
      dp2[0] = 0;
      for (auto &to : g[i]) {
        vector<int> dp3(5001, INF);
        for (int j = 5000; j >= 0; j--) {
          for (int k = 5000 - j; k >= 0; k--) {
            dp3[j + k] = min(dp3[j + k], dp2[j] + dp[to][k]);
          }
        }
        dp3.swap(dp2);
      }
      int ret = INF;
      for (int j = X[i]; j >= 0; j--) ret = min(ret, dp2[j]);
      dp[i][X[i]] = ret;
      for (int j = 5000; j >= 0; j--) {
        if (dp2[j] > X[i]) continue;
        dp[i][j] = min(dp[i][j], X[i]);
      }
    }
  }
  if (dp[0][X[0]] == INF) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << "POSSIBLE" << endl;
  }
}
