#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T qmin(const T &a, const T &b) {
  return a < b ? a : b;
}
template <typename T>
inline T qmax(const T &a, const T &b) {
  return a > b ? a : b;
}
template <typename T>
inline void getmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <typename T>
inline void getmax(T &a, const T &b) {
  if (a < b) a = b;
}
inline void fileio(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const int inf = (int)1e9 + 7;
const long long linf = (long long)1e17 + 7;
const int N = 1005, M = 5005;
int v[M], nxt[M];
int head[N], sum[N], x[N], par[N];
bool can[M];
int n;
inline void addedge(int p, int x, int y) {
  v[p] = y, nxt[p] = head[x], head[x] = p;
}
inline void dfs(int u) {
  if (!head[u]) {
    sum[u] = x[u];
    return;
  }
  memset(can, 0, sizeof(can));
  can[0] = 1;
  int minsum = 0;
  for (int e = head[u]; e; e = nxt[e]) {
    dfs(v[e]);
    for (register int i = (x[u]); i >= (1); --i) {
      if (i >= x[v[e]]) can[i] |= can[i - x[v[e]]];
      if (i >= sum[v[e]] - x[v[e]]) can[i] |= can[i - sum[v[e]] + x[v[e]]];
    }
    minsum += qmin(x[v[e]], sum[v[e]] - x[v[e]]);
    sum[u] += sum[v[e]];
  }
  if (minsum > x[u]) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  int mx = x[u];
  while (!can[mx]) --mx;
  sum[u] += x[u] - mx;
}
int main() {
  scanf("%d", &n);
  for (register int i = (2); i <= (n); ++i) {
    scanf("%d", par + i);
    addedge(i, par[i], i);
  }
  for (register int i = (1); i <= (n); ++i) scanf("%d", x + i);
  dfs(1);
  puts("POSSIBLE");
  return 0;
}
