#include <bits/stdc++.h>
using namespace std;
int N;
int X[1010];
vector<int> children[1010];
bool dp[1010][5010];
int maxID = 5010;
int solveDp(int curPos) {
  vector<pair<int, int> > temp;
  for (int child : children[curPos]) {
    temp.push_back(pair<int, int>(solveDp(child), X[child]));
  }
  int maxW = X[curPos];
  for (int i = 0; i <= temp.size(); ++i) {
    for (int j = 0; j <= maxW; ++j) {
      dp[i][j] = false;
    }
  }
  dp[0][0] = true;
  for (int j = 0; j < temp.size(); ++j) {
    for (int i = 0; i <= maxW; ++i) {
      pair<int, int> p = temp[j];
      if (dp[j][i]) {
        if (i + p.first <= maxW) {
          dp[j + 1][i + p.first] = true;
        }
        if (i + p.second <= maxW) {
          dp[j + 1][i + p.second] = true;
        }
      }
    }
  }
  int allsum = 0;
  for (pair<int, int> p : temp) {
    allsum += p.first + p.second;
  }
  int res = -1;
  for (int i = 0; i <= maxW; ++i) {
    if (dp[temp.size()][i]) {
      res = i;
    }
  }
  if (res == -1) {
    return maxID;
  }
  return allsum - res;
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < (N - 1); ++i) {
    int p;
    scanf("%d", &p);
    children[p - 1].push_back(i + 1);
  }
  for (int i = 0; i < (N); ++i) {
    int x;
    scanf("%d", &x);
    X[i] = x;
  }
  if (solveDp(0) >= maxID) {
    printf("IMPOSSIBLE\n");
  } else {
    printf("POSSIBLE\n");
  }
  return 0;
}
