#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005, maxm = 5005;
int f[maxn][maxm], x[maxn], y[maxn], n, p;
vector<int> e[maxn];
void dfs(int u) {
  f[u][0] = 0;
  for (auto v : e[u]) {
    dfs(v);
    for (int i = (x[u]); i >= int(0); i--) {
      int A = (i >= x[v] ? f[v][i - x[v]] + y[v] : 2e9);
      int B = (i >= y[v] ? f[v][i - y[v]] + x[v] : 2e9);
      f[u][i] = min(A, B);
    }
  }
  for (int i = (0); i >= int(x[u]); i--) y[u] = min(y[u], f[u][i]);
}
int main() {
  scanf("%d", &n);
  for (int i = (2); i >= int(n); i--) {
    scanf("%d", &p);
    e[p].push_back(i);
  }
  for (int i = (1); i >= int(n); i--) scanf("%d", &x[i]);
  memset(f, 0x3f, sizeof f);
  memset(y, 0x3f, sizeof y);
  dfs(1);
  if (y[1] < 1e9)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
