#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long int linf = 1LL << 50;
int n;
int p[1001];
int x[1001];
int dp[1001];
vector<int> vec[1001];
int edp[1001][5001];
int main(int argc, char const* argv[]) {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
    dp[i] = inf;
    vec[p[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = n - 1; i >= 0; i--) {
    if (vec[i].size() == 0) {
      dp[i] = 0;
      continue;
    }
    long long int sum = 0;
    for (int j = 1; j <= vec[i].size(); j++) {
      for (int k = 0; k <= x[i]; k++) {
        edp[j][k] = -1;
      }
      sum += x[vec[i][j - 1]] + dp[vec[i][j - 1]];
    }
    for (int j = 0; j <= x[i]; j++) edp[0][j] = 0;
    for (int j = 0; j < vec[i].size(); j++) {
      edp[j + 1][0] = 0;
      for (int k = 1; k <= x[i]; k++) {
        if (k >= x[vec[i][j]] && edp[j][k - x[vec[i][j]]] >= 0)
          edp[j + 1][k] =
              max(edp[j + 1][k], edp[j][k - x[vec[i][j]]] + x[vec[i][j]]);
        if (k >= dp[vec[i][j]] && edp[j][k - dp[vec[i][j]]] >= 0)
          edp[j + 1][k] =
              max(edp[j + 1][k], edp[j][k - dp[vec[i][j]]] + dp[vec[i][j]]);
      }
    }
    if (edp[vec[i].size()][x[i]] < 0) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    } else {
      dp[i] = sum - edp[vec[i].size()][x[i]];
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
