#include <bits/stdc++.h>
using namespace std;
int n, x[5010], y[5010];
int tote, FIR[5010], TO[5010], NEXT[5010];
bool vis[5010];
void addedge(int u, int v) {
  TO[++tote] = v;
  NEXT[tote] = FIR[u];
  FIR[u] = tote;
}
bool dfs(int u) {
  memset(vis, 0, sizeof(vis));
  vis[0] = 1;
  int i, S0 = 0, S1 = 0;
  for (int p = FIR[u]; p; p = NEXT[p]) {
    int v = TO[p];
    if (!dfs(v)) return 0;
    S0 += min(x[v], y[v]);
    S1 += max(x[v], y[v]);
    int tmp = abs(x[v] - y[v]);
    for (i = 5000 - tmp; i >= 0; i--) vis[i + tmp] |= vis[i];
  }
  if (S0 > x[u]) return 0;
  for (i = x[u] - S0; i >= 0; i--)
    if (vis[i]) {
      y[u] = S1 - i;
      break;
    }
  return 1;
}
int main() {
  int i, f;
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    scanf("%d", &f);
    addedge(f, i);
  }
  for (i = 1; i <= n; i++) scanf("%d", &x[i]);
  puts(dfs(1) ? "POSSIBLE" : "IMPOSSIBE");
}
