#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1010];
int val[1010], sz[1010];
class dp {
 public:
  bool a[5010];
  int mx;
  inline void clear() { memset(a, 0, sizeof(a)); }
  inline void add(int first) {
    if (first <= mx) a[first] = 1;
  }
} cur, tmp;
int dfs(int i) {
  if (!sz[i]) return 0;
  int tot = 0;
  cur.clear();
  cur.a[0] = 1;
  cur.mx = val[i];
  for (int j = sz[i] - 1; ~j; j--) {
    int nxt = adj[i][j], nv = val[nxt], nl = dfs(nxt);
    tot += nv + nl;
    tmp = cur;
    cur.clear();
    cur.mx = val[i];
    for (int k = 0; k <= tmp.mx; k++) {
      if (tmp.a[k]) cur.add(k + nv), cur.add(k + nl);
    }
  }
  for (int j = val[i]; ~j; j--) {
    if (cur.a[j]) return tot - j;
  }
  printf("IMPOSSIBLE");
  exit(0);
}
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int ff;
    scanf("%d", &ff);
    sz[ff]++;
    adj[ff].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &val[i]);
  }
  dfs(1);
  printf("POSSIBLE");
  return 0;
}
