
#include <bitset>
#include <cstdio>
#include <cstdlib>

using namespace std;
const int Max_N(1050);

int N, Head[Max_N], Total, To[Max_N], Next[Max_N], X[Max_N], Y[Max_N];

inline void Add_Edge(const int &s, const int &t)
{
	++Total, To[Total] = t, Next[Total] = Head[s], Head[s] = Total;
}

inline void GG()
{
	puts("IMPOSSIBLE"), exit(0);
}

bitset<5050> F;
void dfs(const int &u)
{
	for (int i = Head[u];i;i = Next[i])
		dfs(To[i]);
	F.reset(), F.set(0);
	int Sum(0);
	for (int i = Head[u], v;i;i = Next[i])
		v = To[i], F = ((F << X[v]) | (F << Y[v])), Sum += X[v] + Y[v];
	for (int i = X[u];i >= 0;--i)
		if (F[i])
		{
			Y[u] = Sum - i;
			goto loop;
		}
	GG();
	loop :
	;
}

int main()
{
	scanf("%d", &N);
	for (int i = 2, fa;i <= N;++i)
		scanf("%d", &fa), Add_Edge(fa, i);
	for (int i = 1;i <= N;++i)
		scanf("%d", X + i);
	dfs(1);
	puts("POSSIBLE");
	return 0;
}