#include <bits/stdc++.h>
using namespace std;
long long N, X[1000], P;
vector<long long> E[1000];
long long dp[1001][5001];
long long dfs(long long v) {
  if (E[v].size() == 0) return 0;
  for (long long i = ((long long)0); i < ((long long)N); i++)
    for (long long j = ((long long)0); j < ((long long)5001); j++)
      dp[i][j] = (1LL << 60);
  dp[0][0] = 0;
  vector<long long> val;
  for (long long i = ((long long)0); i < ((long long)E[v].size()); i++)
    val.push_back(dfs(E[v][i]));
  long long sum = 0;
  for (long long i = ((long long)0); i < ((long long)E[v].size()); i++) {
    long long u = E[v][i], x = X[u], y = val[i];
    if (y == -1) return -1;
    sum += x + y;
    for (long long j = ((long long)0); j < ((long long)5001); j++)
      if (dp[i][j] < (1LL << 60)) {
        if (j + x <= 5000 && dp[i][j] + y <= 5000)
          dp[i + 1][j + x] = min(dp[i + 1][j + x], dp[i][j] + y);
        if (j + y <= 5000 && dp[i][j] + x <= 5000)
          dp[i + 1][j + y] = min(dp[i + 1][j + y], dp[i][j] + x);
      }
  }
  long long ret = (1LL << 60);
  for (long long i = ((long long)0); i < ((long long)5001); i++)
    if (i + dp[E[v].size()][i] == sum && i <= X[v])
      ret = min(ret, dp[E[v].size()][i]);
  return ret < (1LL << 60) ? ret : -1;
}
int main(void) {
  cin >> N;
  for (long long i = ((long long)1); i < ((long long)N); i++) {
    cin >> P;
    E[P - 1].push_back(i);
  }
  for (long long i = ((long long)0); i < ((long long)N); i++) cin >> X[i];
  cout << (dfs(0) >= 0 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
