#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int head[N], to[N], nxt[N], f[N], X[N];
int t, n, possible;
void add(int x, int y) { nxt[++t] = head[x], head[x] = t, to[t] = y; }
int tmp[5005];
void dfs(int u) {
  if (head[u] == -1) {
    f[u] = 0;
    return;
  }
  int sum = 0;
  for (int i = head[u]; i != -1; i = nxt[i])
    dfs(to[i]), sum += X[to[i]] + f[to[i]];
  memset(tmp, 0, sizeof(tmp));
  for (int i = head[u]; i != -1; i = nxt[i]) {
    if (i == head[u]) {
      tmp[X[to[i]]] = 1;
      if (f[to[i]] <= X[u]) tmp[f[to[i]]] = 1;
    } else {
      for (int j = f[to[i]]; j <= X[u]; j++)
        if (tmp[j - f[to[i]]]) tmp[j] = 1;
      for (int j = X[to[i]]; j <= X[u]; j++)
        if (tmp[j - X[to[i]]]) tmp[j] = 1;
    }
  }
  for (int i = X[u]; i >= 0; i--)
    if (tmp[i]) {
      f[u] = sum - i;
      return;
    }
  possible = 0;
}
int main() {
  memset(head, -1, sizeof(head));
  t = -1;
  cin >> n;
  int fa;
  possible = 1;
  for (int i = 2; i <= n; i++) cin >> fa, add(fa, i);
  for (int i = 1; i <= n; i++) cin >> X[i];
  dfs(1);
  if (possible)
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
