#include <bits/stdc++.h>
using namespace std;
const long long MXN = 5e3 + 10;
long long n, Min, x;
long long Par[MXN], X[MXN];
long long dp[MXN][MXN], pd[MXN];
vector<long long> adj[MXN];
bool ok;
void dfs(long long u, long long par) {
  for (auto v : adj[u]) dfs(v, u);
  ok = 0, memset(pd, 63, sizeof pd);
  for (int i = 1; i < MXN; i++) {
    if (dp[u][i] <= X[u] && !ok) ok = 1, Min = i;
  }
  if (!ok) {
    if (u != 1) return;
    cout << "IMPOSSIBLE" << '\n';
    exit(0);
  }
  for (int i = 0; i < MXN; i++) {
    pd[min(i + Min, MXN - 1)] =
        min(pd[min(i + Min, MXN - 1)], dp[par][i] + X[u]);
    pd[min(i + X[u], MXN - 1)] =
        min(pd[min(i + X[u], MXN - 1)], dp[par][i] + Min);
  }
  for (int i = 0; i < MXN; i++) dp[par][i] = pd[i];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> x, adj[x].push_back(i);
  for (int i = 1; i <= n; i++) cin >> X[i];
  dfs(1, 0);
  cout << "POSSIBLE" << '\n';
  return 0;
}
