#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 5010;
struct edge {
  int la,b;
} con[N];
int tot,fir[N];
void add(int from,int to) {
  con[++tot] = (edge) {fir[from],to};
  fir[from] = tot;
}
bitset<M> bit; 
int ned[N],n,dp[N];
bool dfs(int pos) {
  int lea = 0, sum = 0;
  for (int i = fir[pos] ; i ; i = con[i].la) {
    if (!dfs(con[i].b)) return 0;
    lea += min(ned[con[i].b],dp[con[i].b]);
    sum += ned[con[i].b] + dp[con[i].b];
  }
  if (lea > ned[pos]) return 0;
  bit.reset();
  bit[0] = 1;
  for (int i = fir[pos] ; i ; i = con[i].la)
    bit |= (bit << (abs(ned[con[i].b] - dp[con[i].b])));
  for (int i = ned[pos] - lea ; i >= 0 ; -- i) {
    if (bit[i]) {
      dp[pos] = sum - i - lea;
      break;
    }
  }
  return 1;
}
int main() {
  int x;
  scanf("%d",&n);
  for (int i = 2 ; i <= n ; ++ i) {
    scanf("%d",&x);
    add(x,i);
  }
  for (int i = 1 ; i <= n ; ++ i)
    scanf("%d",&ned[i]);
  if (dfs(1)) puts("POSSIBLE");
  else puts("IMPOSSIBLE");
  return 0;
}
