#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1005;
const int mod = 1000000007;
int n;
vector<int> offs[Maxn];
long long X[Maxn];
long long Y[Maxn];
bool flg;
int dp[5010];
void dfs(int v) {
  if (offs[v].size() == 0) {
    Y[v] = 0;
    return;
  }
  for (int i = 0; i < offs[v].size(); i++) {
    dfs(offs[v][i]);
    if (!flg) return;
  }
  long long tsum = 0LL;
  for (int i = 0; i < X[v] + 1; i++) dp[i] = 0;
  dp[X[offs[v][0]]] = 1;
  tsum += X[offs[v][0]];
  dp[Y[offs[v][0]]] = 1;
  tsum += Y[offs[v][0]];
  for (int i = 1; i < offs[v].size(); i++) {
    tsum += X[offs[v][i]];
    tsum += Y[offs[v][i]];
    for (int j = X[v]; j >= 0; j--) {
      if (dp[j] == i) {
        if (j + X[offs[v][i]] <= X[v]) {
          dp[j + X[offs[v][i]]] = i + 1;
        }
        if (j + Y[offs[v][i]] <= X[v]) {
          dp[j + Y[offs[v][i]]] = i + 1;
        }
      }
    }
  }
  for (int i = X[v]; i >= 0; i--) {
    if (dp[i] == offs[v].size()) {
      Y[v] = tsum - i;
      return;
    }
  }
  flg = false;
  return;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    p--;
    offs[p].push_back(i);
  }
  for (int i = 0; i < n; i++) scanf("%d", &X[i]);
  flg = true;
  dfs(0);
  if (flg) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
