#include<bits/stdc++.h>
using namespace std;
using ll = long long;

vector<int> g[1000];
ll x[1000];

// そこ自身以外で提供可能な最小の数
// 根は0

int dfs(int i) {
  if((int) g[i].size() == 0) return 0;
  bitset<5001> dp(1);
  ll s = 0;
  for(int j : g[i]) {
    ll d = dfs(j);
    if(d == -1) return -1;
    dp = (dp << x[j]) | (dp << d);
    s += x[j] + d;
  }
  for(int k = x[i]; k >= 0; k--) {
    if(dp[k]) return s - k;
  }
  return -1;
}

int solve() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n; cin >> n;
  for(int i = 1; i < n; i++) {
    int p; cin >> p; p--;
    g[p].emplace_back(i);
  }
  for(int i = 0; i < n; i++) cin >> x[i];
  return dfs(0) != -1;
}

int main() {
  cout << (solve() ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

