#include <bits/stdc++.h>
using namespace std;
const int MX = 1007;
const int MAXVAL = 5007;
const int INF = 1000 * 1000 * 1000 + 7;
vector<int> g[MX];
int x[MX];
int solve(vector<pair<int, int> > a, int x) {
  bitset<MAXVAL> bs;
  bs[0] = 1;
  for (auto &e : a) {
    bs = (bs << e.first) | (bs << e.second);
  }
  int mx = -1;
  for (int i = 0; i <= x; i++) {
    if (bs[i]) mx = i;
  }
  if (mx == -1) return MAXVAL;
  int res = -mx;
  for (auto &e : a) {
    res += e.first + e.second;
  }
  return min(MAXVAL, res);
}
int dp[MX];
void dfs(int v, int p = -1) {
  vector<pair<int, int> > a;
  for (int to : g[v]) {
    if (to == p) continue;
    dfs(to, v);
    a.push_back(make_pair(x[to], dp[to]));
  }
  dp[v] = solve(a, x[v]);
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d", &p);
    g[p].push_back(i);
    g[i].push_back(p);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x[i]);
  }
  dfs(1);
  if (dp[1] < MAXVAL) {
    printf("POSSIBLE\n");
  } else {
    printf("IMPOSSIBLE\n");
  }
}
