#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const int INF = 0x3f3f3f3f;
const int N = 1e3 + 10, Lim = 5e3 + 10;
bitset<Lim> A, B;
int to[N << 1], nex[N << 1], beg[N];
int Min[N], val[N];
int e;
inline int read() {
  int x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') flag = -1, ch = getchar();
  while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch - '0'), ch = getchar();
  return x * flag;
}
inline void add(int x, int y) { to[++e] = y, nex[e] = beg[x], beg[x] = e; }
inline void Dp(int x, int fa) {
  for (int i = beg[x]; i; i = nex[i]) {
    if (to[i] == fa) continue;
    Dp(to[i], x);
  }
  A.reset(), A[0] = true;
  int sum = 0, tot = 0;
  for (int i = beg[x]; i; i = nex[i]) {
    if (to[i] == fa) continue;
    int Minv = min(Min[to[i]], val[to[i]]);
    int Maxv = max(Min[to[i]], val[to[i]]);
    A |= (A << (Maxv - Minv)), sum += Minv, tot += Minv + Maxv;
  }
  for (int i = (max(0, tot - val[x] - sum)), iend = (tot - sum * 2); i <= iend;
       i++)
    if (A[i]) {
      Min[x] = i + sum;
      break;
    }
  if (Min[x] == INF) puts("IMPOSSIBLE"), exit(0);
}
int main() {
  int n = read();
  for (int i = (2), iend = (n); i <= iend; i++) {
    int f = read();
    add(f, i);
  }
  for (int i = (1), iend = (n); i <= iend; i++) val[i] = read();
  memset(Min, 63, sizeof(Min));
  Dp(1, 0);
  puts("POSSIBLE");
  return 0;
}
