#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int n, x[1000], ans[1000];
vector<vector<int>> e;

void rec(int c, int p){
	vector<int> dp(5010, 1e9);
	dp[0] = 0;
	for(int i : e[c]) if(i != p){
		rec(i, c);
		vector<int> next(5010, 1e9);
		for(int j = 0; j < 5010; j++){
			if(j + x[i] < 5010) next[j + x[i]] = min(next[j + x[i]], dp[j] + ans[i]);
			if(j + ans[i] < 5010) next[j + ans[i]] = min(next[j + ans[i]], dp[j] + x[i]);
		}
		dp.swap(next);
	}
	ans[c] = 1e9;
	rep(i, x[c]+1) ans[c] = min(ans[c], dp[i]);
}

int main(){
	cin >> n; e.resize(n);
	for(int i = 1; i < n; i++){
		int p; cin >> p; p--;
		e[i].push_back(p);
		e[p].push_back(i);
	}
	rep(i, n) cin >> x[i];
	rec(0, 0);
	cout << (ans[0] < 1e9 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	//rep(i, n) cerr<<"i:"<<i<<" ans:"<<ans[i]<<endl;
	return 0;
}
