#include <bits/stdc++.h>
using namespace std;
int n, p[1007], x[1007], dp[1007][5007], f[1007][5007], t, fa, lim;
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = n; i > 0; i--) {
    fa = p[i], lim = x[i];
    for (int j = x[fa]; j >= 0; j--) {
      if (lim <= j)
        dp[fa][j] = dp[fa][j - lim] + dp[i][lim];
      else
        dp[fa][j] = (int)1e9;
      if (dp[i][lim] <= j) {
        t = (dp[i][lim] == 0 ? 0 : dp[fa][j - dp[i][lim]]) + lim;
        if (dp[fa][j] > t) dp[fa][j] = t;
      }
    }
  }
  cout << (dp[1][x[1]] < (int)1e9 ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
