#include <bits/stdc++.h>
using namespace std;
template <class T>
using reversed_priority_queue = priority_queue<T, vector<T>, greater<T>>;
char moji[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
                 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
char moji2[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
                  'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
                  'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
char moji3[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
void myprint(long long* A, long long A_num) {
  for (long long i = 0; i < A_num; i++) cout << A[i] << " ";
  cout << endl;
}
long long n;
vector<long long> child[1005];
long long X[1005];
bool dp[200][5005];
long long DFS(long long v) {
  if (child[v].size() == 0) return 0;
  vector<pair<long long, long long>> sum_of_child;
  long long summ = 0;
  for (auto itr = child[v].begin(); itr != child[v].end(); itr++) {
    long long res = DFS(*itr);
    if (res == -1) {
      cout << *itr << endl;
      return -1;
    }
    sum_of_child.push_back(make_pair(X[*itr], res));
    summ += X[*itr] + res;
  }
  long long tmpn = sum_of_child.size();
  for (long long i = 0; i < tmpn + 1; i++)
    for (long long j = 0; j < 5005; j++) dp[i][j] = false;
  dp[0][0] = true;
  for (long long i = 0; i < tmpn; i++) {
    long long w1 = sum_of_child[i].first;
    long long w2 = sum_of_child[i].second;
    for (long long j = 0; j < 5005; j++) {
      if (j - w1 >= 0 and dp[i][j - w1]) dp[i + 1][j] = true;
      if (j - w2 >= 0 and dp[i][j - w2]) dp[i + 1][j] = true;
    }
  }
  long long ma = -1;
  for (long long i = X[v]; i >= 0; i--) {
    if (dp[tmpn][i]) {
      ma = i;
      break;
    }
  }
  long long ret = summ - ma;
  if (ma == -1)
    return -1;
  else
    return ret;
}
signed main() {
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long parent;
    cin >> parent;
    parent--;
    child[parent].push_back(i);
  }
  for (long long i = 0; i < n; i++) cin >> X[i];
  if (DFS(0) == -1)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "POSSIBLE" << endl;
}
