#include <bits/stdc++.h>

using namespace std;

int x[1005], sum[1005];
vector<int> g[1005];

bool solve(int cur) {
	sum[cur] += x[cur];
	if (g[cur].empty()) return true;
	int mins = 0;
	vector<int> dp(x[cur] + 1, false);
	dp[0] = true;
	for (int nex : g[cur]) {
		if (!solve(nex)) return false;
		int minv = min(x[nex], sum[nex] - x[nex]);
		int dis = max(x[nex], sum[nex] - x[nex]) - minv;
		mins += minv;
		for (int i = x[cur]; i >= dis; i--) {
			dp[i] |= dp[i - dis];
		}
		sum[cur] += sum[nex];
	}
	for (int i = x[cur] - mins; i >= 0; i--) {
		if (dp[i]) {
			sum[cur] -= mins + i;
			return true;
		}
	}
	return false;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int p;
		cin >> p;
		p--;
		g[p].push_back(i);
	}

	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}

	cout << (solve(0) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}