#include <iostream>
#include <cstdio>
#include <vector>
#include <bitset>
#define N 1005
using namespace std;

int n, t, s, x[N], y[N];
vector<int> a[N];
bitset<5005> bs;
int main()
{
	int i, j;
	cin >> n;
	for (i = 2; i <= n; i++) {
		scanf ("%d", &t);
		a[t].push_back(i);
	}
	for (i = 1; i <= n; i++) {
		scanf ("%d", &x[i]);
	}
	for (i = n; i >= 1; i--) {
		bs = 1;
		s = 0;
		for (j = 0; j < a[i].size(); j++) {
			t = a[i][j];
			bs = (bs << x[t] | bs << y[t]);
			s += x[t] + y[t];
		}
		for (j = x[i]; j >= 0; j--) if (bs[j]) break;
		y[i] = s - j;
		if (j < 0) {
			cout << "IMPOSSIBLE";
			return 0;
		}
//		for (j = 0; j <= x[i]; j++) {
//			if (bs[x[i] - j] || bs[s - x[i] - j]) break;
//		}
//		if (j > x[i]) break;
//		printf("%d\n", bs[0]);
	}
	cout << "POSSIBLE";
    return 0;
}
