#include "bits/stdc++.h"
using namespace std;
const int N = 5e3 + 3;
int n;
int parent[N];
vector < int > v[N];
int arr[N];
int dp[N];
bitset < N > bit;
int main(){
	scanf("%d" , &n);
	for(int i = 2 ; i <= n ; ++i){
		scanf("%d" , parent + i);
		v[parent[i]].emplace_back(i);
	}
	for(int i = 1 ; i <= n ; ++i){
		scanf("%d" , arr + i);
	}
	for(int i = n ; i >= 1 ; --i){
		if(v[i].empty()){
			dp[i] = 0;
		}
		else{
			bit.reset();
			bit.set(0);
			long long tot = 0;
			for(int next : v[i]){
				tot += arr[next] + dp[next];
				bit = (bit << arr[next]) | (bit << dp[next]);
			}
			dp[i] = -1;
			for(int j = arr[i] ; j >= 0 ; --j){
				if(bit.test(j)){
					dp[i] = tot - j;
					break;
				}
			}
			if(dp[i] == -1){
				printf("IMPOSSIBLE\n");
				return 0;
			}
		}
	}
	printf("POSSIBLE\n");
}