#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 5010, oo = 2e9;
int n, f1[N], f2[M], x[N], fa[N];
vector<int> son[N];
bool dfs(int k) {
  int l = son[k].size(), now, tot = 0;
  if (!l) return 1;
  for (int i = 0; i < l; i++) {
    if (!dfs(son[k][i])) return 0;
    tot += x[son[k][i]] + f1[son[k][i]];
  }
  memset(f2, 0, sizeof(f2));
  for (int i = 0; i < l; i++)
    for (int j = x[k]; j >= 0; j--) {
      now = son[k][i];
      if (j >= x[now]) {
        f2[j] = max(f2[j], f2[j - x[now]] + x[now]);
        if (f2[j - x[now]] < 0) f2[j] = -oo;
      }
      if (j >= f1[now]) {
        f2[j] = max(f2[j], f2[j - f1[now]] + f1[now]);
        if (f2[j - f1[now]] < 0) f2[j] = -oo;
      }
      if (j < x[now] && j < f1[now]) f2[j] = -oo;
    }
  if (f2[x[k]] < 0) return 0;
  f1[k] = tot - f2[x[k]];
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &fa[i]);
    son[fa[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  if (dfs(1))
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
