#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
template <class T>
inline void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
const long long INF = 1LL << 60;
const long long DIV = (long long)1e9 + 7;
class Node {
 public:
  vector<long> to;
  int w[2] = {0, 0};
  int ws = 0;
  bool seen = false;
  bool finish = false;
  Node() { ; };
};
vector<Node> vGr;
const int MAXX = 5100;
int solve(vector<long long> vw[2], int ws) {
  long long N = vw[0].size();
  long long dp[N + 1][MAXX];
  for (int i = 0; i < (int)(N + 1); i++)
    for (int j = 0; j < (int)(MAXX); j++) dp[i][j] = INF;
  dp[0][0] = 0;
  for (int i = 0; i < (int)(N); i++)
    for (int j = 0; j < (int)(MAXX); j++) {
      if (max(j + vw[0][i], dp[i][j] + vw[1][i]) < MAXX)
        chmin(dp[i + 1][max(j + vw[0][i], dp[i][j] + vw[1][i])],
              min(j + vw[0][i], dp[i][j] + vw[1][i]));
      if (max(j + vw[1][i], dp[i][j] + vw[0][i]) < MAXX)
        chmin(dp[i + 1][max(j + vw[1][i], dp[i][j] + vw[0][i])],
              min(j + vw[1][i], dp[i][j] + vw[0][i]));
    }
  long long ans = INF;
  for (int j = 0; j < (int)(ws + 1); j++) chmin(ans, dp[N][j]);
  if (ans != INF) return ans;
  for (int j = 0; j < (int)(MAXX); j++) {
    if (dp[N][j] <= ws) return j;
  }
  return -1;
}
bool dfs(int vertex) {
  vector<long long> vw[2];
  for (auto el : vGr[vertex].to) {
    if (!dfs(el)) return false;
    vw[0].push_back(vGr[el].w[0]);
    vw[1].push_back(vGr[el].w[1]);
  }
  vGr[vertex].w[0] = vGr[vertex].ws;
  vGr[vertex].w[1] = solve(vw, vGr[vertex].ws);
  if (vGr[vertex].w[1] < 0) return false;
  return true;
};
int main(void) {
  long long N;
  cin >> N;
  vGr.resize(N);
  for (int i = 0; i < (int)(N - 1); i++) {
    int p;
    cin >> p;
    vGr[p - 1].to.push_back(i + 1);
  }
  for (int i = 0; i < (int)(N); i++) {
    int x;
    cin >> x;
    vGr[i].ws = x;
  }
  if (dfs(0))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
