#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int f[1050][5050];
int p[1050],x[1050];

int main() {
  int n;
  cin >> n;
  for(int i=2;i<=n;i++) {
    cin >> p[i];
  }
  for(int i=1;i<=n;i++) cin >> x[i];
  for(ll i=n;i;i--) {
    for(ll j=x[p[i]];j>=0;j--) {
      f[p[i]][j]=min(x[i]<=j?f[p[i]][j-x[i]]+f[i][x[i]]:(ll)1e9,f[i][x[i]]<=j?f[p[i]][j-f[i][x[i]]]+x[i]:(ll)1e9);
    }
  }
  if(f[1][x[1]]<(ll)1e9) {
    cout << "POSSIBLE" << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}