#include<bits/stdc++.h>
using namespace std;
void IMP(){puts("IMPOSSIBLE"); exit(0);}

vector<int> conn[1010];
int P[1010];
int X[1010];
int W[1010]; // i node X[i] - W[i]
int N;

void doDP(int v)
{
  int capacity = X[v];
  int Wval = 0;
  vector<int> childs;
  for(auto x: conn[v])
  {
    capacity -= min(X[x], W[x]);
    childs.push_back(abs(X[x]-W[x]));
    Wval += X[x] + W[x];
  }
  if(capacity < 0) IMP();
  vector<bool> DP(capacity+1, false); DP[0] = true;
  for(auto x: childs)
    for(int i=capacity-x; i>=0; --i)
      if(DP[i]) DP[i+x] = true;
  for(int i=capacity; i>=0; --i)
    if(DP[i])
    {
      Wval += capacity-i;
      W[v] = Wval-X[v];
      return;
    }
}
int main()
{
  scanf("%d", &N);
  for(int i=2; i<=N; ++i)
  {
    scanf("%d", P+i);
    conn[P[i]].push_back(i);
  }
  for(int i=1; i<=N; ++i)
    scanf("%d", X+i);
  for(int i=N; i>=1; --i)
    doDP(i);
  puts("POSSIBLE");
  return 0;
}