#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
vector<int> g[maxn];
int n, v[maxn], dp[maxn][5010], f[maxn];
int dfs(int pos) {
  dp[pos][0] = 0;
  for (auto u : g[pos]) {
    int w = dfs(u), k = v[u];
    memcpy(f, dp[pos], sizeof(f));
    memset(dp[pos], 0x3f3f3f, sizeof(dp[pos]));
    for (int j = 0; j <= v[pos]; j++) {
      if (w <= j) dp[pos][j] = min(dp[pos][j], f[j - w] + k);
      if (k <= j) dp[pos][j] = min(dp[pos][j], f[j - k] + w);
    }
  }
  int ans = dp[0][0];
  for (int i = 0; i <= v[pos]; i++) ans = min(ans, dp[pos][i]);
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int p, i = 2; i <= n; i++) {
    scanf("%d", &p);
    g[p].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  memset(dp, 0x3f3f3f, sizeof(dp));
  if (dfs(1) < dp[0][0])
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
