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