#include <bits/stdc++.h>
using namespace std;

const int N = 1e3+3, M = 5e3+2;
vector <int> g[N];
int X[N], ok = 1;
int dp[N];
// 0 = black

void dfs(int v){
	int sum = 0, yes = 0;
	for (auto it: g[v]) {
		dfs(it), sum += dp[it] + X[it];
		if (X[it] == 0 || dp[it] == 0) yes = 1;
	}
	bool tmp1[M], tmp2[M];
	memset(tmp1, 0, sizeof(tmp1));
	tmp1[0] = 1;
	for (int it: g[v]){
		memset(tmp2, 0, sizeof(tmp2));
		for (int i = M - 1; i >= 0; i--){
			if (tmp1[i]){
				if (i + dp[it] < M) tmp2[i+dp[it]] = 1;
				if (i + X[it] < M) tmp2[i+X[it]] = 1;
			}
		}
		for (int i = 0; i < M; i++) tmp1[i] = tmp2[i];
	}
	// if (yes || g[v].size() == 0) tmp1[0] = 1;
	// else tmp1[0] = 0;

	for (int i = X[v]; i >= 0; i--){
		if (tmp1[i]) {
			dp[v] = sum - i;
			if (dp[v] < 0) abort();
			return;
		}
	}
	ok = 0;
}


int main(){
	int n; cin >> n;
	for (int i = 2; i <= n; i++){
		int x; scanf("%d",&x);
		g[x].push_back(i);
	}
	for (int i= 1; i <= n; i++) scanf("%d",&X[i]);
	dfs(1);
	puts(ok?"POSSIBLE":"IMPOSSIBLE");
}