#include <bits/stdc++.h>

using namespace std;

#ifdef WIN32
	#define I64 "%I64d"
#else
	#define I64 "%lld"
#endif

typedef long long ll;

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
#define sz(s) (int(s.size()))
#define fname "a"
#define MAXN 2002
#define MAXS 5005

int n;
int d[MAXN];
bitset<MAXS> f, ff;
vector <int> g[MAXN];
int a[MAXN];

void dfs(int v = 0) {
	d[v] = 0;
	f.reset();
	f[0] = 1;
	int s = 0;
	int w = 0;
	for (const int& v2 : g[v]) {
		dfs(v2);
		ff = f << a[v2];
		ff |= f << d[v2];
		s += a[v2];
		s += d[v2];
		f = ff;
		++w;
	}
	if (!w) {
		return;
	}
//	cout << v + 1 << ' ' << f._Find_first() << endl;
	if (f._Find_first() > a[v]) {
		puts("IMPOSSIBLE");
		exit(0);
	}
	d[v] = s - a[v] + (a[v] - f._Find_first());
//	cout << v + 1 << ' ' << " d[v] = " << d[v] << endl;
}

int main()
{
	#ifdef LOCAL
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#endif

	scanf("%d", &n);
	for (int i = 1; i < n; ++i) {
		int p;
		scanf("%d", &p);
		--p;
		g[p].pb(i);
	}

	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
	}

	dfs();

	puts("POSSIBLE");

	return 0;
}
