#include <bits/stdc++.h>
using namespace std;
int read();
int n;
queue<int> q;
int fa[1003], deg[1003], x[1003], y[1003];
int f[1003][5003];
void insert(int u) { return --deg[u] ? void() : q.push(u); }
void update(int u, int a, int b) {
  for (int i = x[u]; i >= 0; --i) {
    if (i >= b)
      f[u][i] = min(f[u][i - a] + b, f[u][i - b] + a);
    else if (i < a)
      f[u][i] = 10000;
    else
      f[u][i] = f[u][i - a] + b;
  }
}
int main() {
  n = read();
  for (int i = 2; i <= n; ++i) deg[fa[i] = read()]++;
  for (int i = 1; i <= n; ++i) x[i] = read();
  for (int i = 1; i <= n; ++i) deg[i] ? void() : q.push(i);
  while (!q.empty()) {
    int u = q.front(), v = fa[u];
    q.pop(), insert(v);
    if ((y[u] = f[u][x[u]]) > 5000) return puts("IMPOSSIBLE"), 0;
    if (!v) break;
    if (x[u] > y[u]) swap(x[u], y[u]);
    update(v, x[u], y[u]);
  }
  puts("POSSIBLE");
  return 0;
}
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
