#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll dp[1000];
ll sdp[1001][5001];
vector<int> G[1000];
int X[1000];
void solve(int v) {
	for (int to : G[v]) {
		solve(to);
	}
	for (int i = 0; i <= G[v].size(); i++) {
		for (int j = 0; j <= X[v]; j++) sdp[i][j] = 1LL << 60;
	}
	sdp[0][0] = 0;
	for (int i = 0; i < G[v].size(); i++) {
		for (int j = 0; j <= X[v]; j++) {
			if (sdp[i][j] == 1LL << 60) continue;
			int c = G[v][i];
			if (j + X[c] <= X[v]) sdp[i + 1][j + X[c]] = min(sdp[i + 1][j + X[c]], sdp[i][j] + dp[c]);
			if (j + dp[c] <= X[v]) sdp[i + 1][j + dp[c]] = min(sdp[i + 1][j + dp[c]], sdp[i][j] + X[c]);
		}
	}
	ll ans = 1LL << 60;
	for (int i = 0; i <= X[v]; i++) ans = min(ans, sdp[G[v].size()][i]);
	dp[v] = ans;
}
 int main() {
	 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];
	 solve(0);
	 if (dp[0] < (1LL << 60)) cout << "POSSIBLE" << endl;
	 else cout << "IMPOSSIBLE" << endl;
}