#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e3 + 7;
const int maxV = 5e3 + 7;
const int INF = 1e9 + 7;
const int V = 5000;
template <class T>
inline T rd() {
  bool f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 0;
  T x = 0;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return f ? x : -x;
}
inline bool NIE() {
  puts("IMPOSSIBLE");
  exit(0);
}
inline bool TAK() {
  puts("POSSIBLE");
  exit(0);
}
int n, val[maxN], els[maxN];
int dp[maxN][maxV];
struct vec {
  static const int maxE = maxN;
  int g[maxN], te;
  struct edge {
    int y, nxt;
  } e[maxE];
  inline void push(int x, int y) {
    e[++te] = (edge){y, g[x]};
    g[x] = te;
  }
  inline int& operator()(int x) { return g[x]; }
  inline edge& operator[](int x) { return e[x]; }
} e;
inline void Min(int& x, int y) { (x == -1 || x > y) ? x = y : 0; }
void dfs(int x) {
  int f[maxV], g[maxV];
  dp[x][0] = 0;
  for (int i = (1), _ = (V); i <= _; ++i) dp[x][i] = -1;
  for (int p = e(x), y = e[p].y; p; y = e[p = e[p].nxt].y) {
    dfs(y);
    for (int i = (0), _ = (V); i <= _; ++i) f[i] = g[i] = -1;
    int v = val[y], w = els[y];
    for (int i = (V), _ = (v); i >= _; --i)
      if (~dp[x][i - v]) Min(f[i], dp[x][i - v] + w);
    v = els[y], w = val[y];
    for (int i = (V), _ = (v); i >= _; --i)
      if (~dp[x][i - v]) Min(g[i], dp[x][i - v] + w);
    for (int i = (0), _ = (V); i <= _; ++i) dp[x][i] = f[i];
    for (int i = (0), _ = (V); i <= _; ++i) Min(dp[x][i], g[i]);
  }
  els[x] = INF;
  for (int i = (0), _ = (val[x]); i <= _; ++i)
    if (~dp[x][i]) els[x] = min(els[x], dp[x][i]);
  if (els[x] == INF) NIE();
}
int main() {
  n = rd<int>();
  for (int i = (2), _ = (n); i <= _; ++i) e.push(rd<int>(), i);
  for (int i = (1), _ = (n); i <= _; ++i) val[i] = rd<int>();
  dfs(1);
  TAK();
  return 0;
}
