#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 1005;
const int MAXX = 5005;
const int INF = (LL)1e9 + 5;

int X[MAXN], minv[MAXN], dp[MAXX], N;
vector<int> ch[MAXN];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N;
	for (int i = 2; i <= N; i++) {
		int p;
		cin >> p;
		ch[p].push_back(i);
	}
	
	bool ok = true;
	for (int i = 1; i <= N; i++) cin >> X[i];
	for (int v = N; v >= 1; v--) {
		fill(dp, dp + 5001, INF);
		dp[0] = 0;
		
		for (int to : ch[v]) {
			int c1 = X[to], c2 = minv[to];
			for (int j = 5000; j >= 0; j--) {
				int a = INF, b = INF;
				if (j >= c1) a = dp[j - c1] + c2;
				if (j >= c2) b = dp[j - c2] + c1;
				dp[j] = min(a, b);
			}
		}
		
		minv[v] = *min_element(dp, dp + X[v] + 1);
		if (minv[v] == INF) {
			ok = false;
			break;
		}
	}
	
	if (!ok) cout << "IM";
	cout << "POSSIBLE\n";
	
	return 0;
	
	/**** Note MAXN ****/
}
