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

int n, x[N], y[N];
vector<int> a[N];

void f(int p) {
	int i, t, s = 0;
	bitset<5005> bs;
	bs = 1;
	for (i = 0; i < a[p].size(); i++) {
		t = a[p][i];
		f(t);
		bs = bs << x[t] | bs << y[t];
		s += x[t] + y[t];
	}
	for (i = x[p]; i >= 0; i--) if (bs[i]) break;
	if (i < 0) {cout << "IMPOSSIBLE"; exit(0);}
	y[p] = s - i;
}

int main()
{
	int i, t;
	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]);
	f(1);
	cout << "POSSIBLE";
    return 0;
}