#include <bits/stdc++.h>
using namespace std;
const int MAX = 1010;
const int MAX_X = 5050;
int N;
vector<int> child[MAX];
int X[MAX];
int temp[2];
string ans;
vector<int> dp1, dp2;
void dfs(int n) {
  if (child[n].size() == 0) {
    temp[0] = 0;
    temp[1] = X[n];
    return;
  }
  dp1 = vector<int>(MAX_X, false);
  dp1[0] = true;
  int S = 0;
  for (auto& v : child[n]) {
    dfs(v);
    S += temp[0] + temp[1];
    dp2 = vector<int>(MAX_X, false);
    for (int i = X[n] + 1 - 1; i >= 0; --i)
      if (dp1[i]) {
        for (int k = 0; k < 2; ++k)
          if (i + temp[k] <= X[n]) dp2[i + temp[k]] = true;
      }
    dp1 = dp2;
  }
  int value = -1;
  for (int i = MAX_X - 1; i >= 0; --i)
    if (dp1[i]) {
      value = i;
      break;
    }
  if (value == -1) {
    ans = "IMPOSSIBLE";
    value = 0;
  }
  temp[0] = X[n];
  temp[1] = S - value;
}
int main() {
  cin >> N;
  ans = "POSSIBLE";
  for (int i = 2; i < N + 1; ++i) {
    int p;
    cin >> p;
    child[p].push_back(i);
  }
  for (int i = 1; i < N + 1; ++i) cin >> X[i];
  dfs(1);
  cout << ans << endl;
}
