#include <bits/stdc++.h>
using namespace std;
int n, tot;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != EOF) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ((c <= '9' && c >= '0') && c != EOF) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int head[1020], nex[1020], to[1020], v[1020];
void add(int x, int y) {
  nex[tot] = head[x];
  to[++tot] = y;
  head[x] = tot;
}
int dp[1020][1020 * 5], temp[1020 * 5];
int dfs(int r) {
  dp[r][0] = 0;
  for (int i = head[r]; i; i = nex[i]) {
    int w = dfs(to[i]), b = v[to[i]];
    memcpy(temp, dp[r], sizeof(temp));
    memset(dp[r], 99999999999, sizeof(dp[r]));
    for (int j = 0; j <= v[r]; j++) {
      if (j + w <= v[r]) {
        if (temp[j] + b < dp[r][j + w]) {
          dp[r][j + w] = temp[j] + b;
        }
      }
      if (j + b <= v[r]) {
        if (dp[r][j + b] > temp[j] + w) {
          dp[r][j + b] = temp[j] + w;
        }
      }
    }
  }
  int ans = dp[0][0];
  for (int i = 0; i <= v[r]; i++) {
    if (ans > dp[r][i]) {
      ans = dp[r][i];
    }
  }
  return ans;
}
int main() {
  memset(dp, 99999999999, sizeof(dp));
  n = read();
  for (int i = 2; i <= n; i++) {
    int x;
    x = read();
    add(x, i);
  }
  for (int i = 1; i <= n; i++) v[i] = read();
  int p = 0;
  int res = dfs(p + 1);
  if (res < dp[0][0]) return printf("POSSIBLE\n"), 0;
  printf("IMPOSSIBLE\n");
}
