#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
struct edge {
  int nxt, to;
} e[N];
int fir[N], cnt = 0;
bool legal[N][2];
int X[N];
inline void add(int x, int y) {
  e[++cnt] = (edge){fir[x], y};
  fir[x] = cnt;
}
inline void dfs(int x) {
  for (int i = fir[x]; i; i = e[i].nxt) dfs(e[i].to);
  vector<bool> dp[2];
  dp[0].resize(5005);
  dp[1].resize(5005);
  dp[0][0] = dp[1][0] = 1;
  for (int i = fir[x]; i; i = e[i].nxt)
    for (int j = 0; j < 2; j++)
      if (legal[e[i].to][j]) {
        for (int k = 5000; k >= X[e[i].to]; k--) {
          if (dp[j][k - X[e[i].to]]) {
            dp[j][k] = 1;
            if (!legal[e[i].to][j ^ 1]) dp[j][k - X[e[i].to]] = 0;
          }
        }
      }
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j <= X[x]; j++)
      if (dp[i][j]) {
        legal[x][i] = 1;
        break;
      }
  }
}
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &x);
    add(x, i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &X[i]);
  dfs(1);
  if (legal[1][0] || legal[1][1])
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
