#include <bits/stdc++.h>
using namespace std;
int OK = 1;
vector<int> eda[1001];
int X[1001];
pair<int, int> sagasu(int A) {
  if (OK) {
    int saishou = 0;
    int saidai = 0;
    map<int, int> MP;
    for (int i : eda[A]) {
      pair<int, int> P = sagasu(i);
      saishou += P.first;
      saidai += P.second;
      MP[P.second - P.first]++;
    }
    if (X[A] >= saishou && X[A] < saidai) {
      int ikeru[5001] = {};
      ikeru[saishou] = 1;
      for (auto itr : MP) {
        for (int i = 0; i < (5000); i++) {
          if (ikeru[i]) {
            for (int ii = 0; ii < (itr.second); ii++) {
              if (i + ii * itr.first < 5001) {
                ikeru[i + ii * itr.first] = 1;
              }
            }
          }
        }
      }
      int girigiri = 10000;
      for (int i = X[A]; i >= 0; i--) {
        if (ikeru[i]) {
          girigiri = i;
          break;
        }
      }
      return make_pair(min(X[A], saishou + saidai - girigiri),
                       max(X[A], saishou + saidai - girigiri));
    } else if (X[A] < saishou) {
      OK = 0;
      return make_pair(10000, 0);
    } else {
      return make_pair(saishou, X[A]);
    }
  } else
    return make_pair(10000, 0);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i = 1; i <= (N - 1); i++) {
    int P;
    cin >> P;
    eda[P].push_back(i + 1);
  }
  for (int i = 1; i <= (N); i++) cin >> X[i];
  sagasu(1);
  if (OK)
    cout << ("POSSIBLE") << "\n";
  else
    cout << ("IMPOSSIBLE") << "\n";
  return 0;
}
