#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <bitset>

using namespace std;
typedef long long LL;
const int maxn = 1005;
const int maxm = 5005;

int n,x[maxn],f[maxn],p[maxn];
bool dp[maxn][maxm];int sum[maxn];

int main()
{
	#ifdef Amberframe
		freopen("arc083e.in","r",stdin);
		freopen("arc083e.out","w",stdout);
	#endif
	scanf("%d",&n);
	for (int i=2;i<=n;i++) scanf("%d",&p[i]);
	for (int i=1;i<=n;i++) scanf("%d",&x[i]);
	for (int i=1;i<=n;i++) dp[i][0]=true;
	for (int i=n;i>=1;i--)
	{
		int j=x[i];while (j>=0&&!dp[i][j]) --j;
		if (j<0) {puts("IMPOSSIBLE");return 0;}
		f[i]=sum[i]-j;int a=p[i];sum[a]+=f[i]+x[i];
		for (int j=x[a];j>=0;j--)
		{
			bool tag=false;
			tag|=j>=f[i]&&dp[a][j-f[i]];
			tag|=j>=x[i]&&dp[a][j-x[i]];
			dp[a][j]=tag;
		}
	}
	puts("POSSIBLE");
	return 0;
}