#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> son[1010];
int x[1010];
int z[1010];
int dp1[10010],dp2[10010];
void dp(int &x, int y)
{
	if(x == -1 || x > y) x = y;
}
int main()
{
	scanf("%d", &n);
	for (int i = 2; i <= n; ++i)
	{
		int y;
		scanf("%d", &y);
		son[y].push_back(i);
	}
	for(int i = 1; i <= n; ++i)
		scanf("%d",&x[i]);
	for(int i = n; i >= 1; --i)
	{
		memset(dp1, -1, sizeof(dp1));
		dp1[0] = 0;
		vector<int>::iterator it;
		for( it = son[i].begin(); it != son[i].end(); ++it)
		{
			int hei = x[*it], bai = z[*it];
			memset(dp2,-1,sizeof(dp2));
			for(int j = 0; j <= x[i]; ++j)
				if(dp1[j] != -1)
				{
					if(j + hei <= x[i])
						dp(dp2[j + hei], dp1[j] + bai);
					if(j + bai <= x[i])
						dp(dp2[j + bai], dp1[j] + hei);
				}
			memcpy(dp1, dp2, sizeof(dp2));
		}
		int res = -1;
		for(int j = x[i]; j >= 0; --j)
			if(dp1[j] != -1)
				dp(res, dp1[j]);
		if(res == -1)
		{
			puts("IMPOSSIBLE");
			return 0;
		}
		z[i] = res;
	}
	puts("POSSIBLE");
	return 0;
}
