#include <bits/stdc++.h>
using namespace std;
inline int read(int r = 0, int s = 0, int c = getchar()) {
  for (; c < 48 || c > 57; s = c, c = getchar())
    ;
  for (; c >= 48 && c <= 57; (r *= 10) += c - 48, c = getchar())
    ;
  return s ^ '-' ? r : -r;
}
vector<int> e[1025];
int f[1025][1025], X[1025], n, m;
void DP(int p) {
  for (auto v : e[p])
    for (register int i = (DP(v), X[p]); ~i; i--)
      f[p][i] = min(i >= X[v] ? f[p][i - X[v]] + f[v][X[v]] : 0x3f3f3f3f,
                    i >= f[v][X[v]] ? f[p][i - f[v][X[v]]] + X[v] : 0x3f3f3f3f);
}
int main() {
  n = read();
  for (register int i = 2; i <= n; e[read()].push_back(i), i++)
    ;
  for (register int i = 1; i <= n; m = max(m, X[i++] = read()))
    ;
  DP(1);
  puts(f[1][X[1]] < 0x3f3f3f3f ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
