#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 10, K = 5000;
const int MOD = 1000000007;
const int LOG = 20;
const int INF = 10000010;
int dp[2][N][K], n, X[N], DP[N];
vector<int> G[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    G[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> X[i];
  memset(dp, 31, sizeof dp);
  for (int i = n; i >= 1; i--) {
    bool f = 1;
    dp[0][i][0] = 0;
    for (auto u : G[i]) {
      memset(dp[f], 31, sizeof dp[f]);
      for (int j = X[i]; j >= 0; j--) {
        int x = j + X[u];
        if (x <= X[i]) dp[f][i][x] = min(dp[f][i][x], dp[f ^ 1][i][j] + DP[u]);
        x = j + DP[u];
        if (x <= X[i]) dp[f][i][x] = min(dp[f][i][x], dp[f ^ 1][i][j] + X[u]);
      }
      f ^= 1;
    }
    int mn = INF;
    f ^= 1;
    for (int j = 0; j <= X[i]; j++) {
      mn = min(mn, dp[f][i][j]);
    }
    if (mn == INF) return cout << "IMPOSSIBLE", 0;
    DP[i] = mn;
  }
  cout << "POSSIBLE";
  return 0;
}
