#include <bits/stdc++.h>

const int N = 1054, W = 5054, INF = 0x3f3f3f3f;

int n;
int p[N], fc[N], nc[N];
int s[N], f[N];
int dp[2][W], *cur = *dp, *nxt = dp[1];

inline void link(int x, int px) {p[x] = px, nc[x] = fc[px], fc[px] = x;}
inline void down(int &x, const int y) {x > y ? x = y : 0;}

void dfs(int x) {
	int i, y;
	for (y = fc[x]; y; y = nc[y]) dfs(y);
	memset(nxt, 63, sizeof *dp), *nxt = 0;
	for (y = fc[x]; y; y = nc[y]) {
		std::swap(cur, nxt), memset(nxt, 63, sizeof *dp);
		for (i = s[y]; i <= s[x]; ++i) down(nxt[i], cur[i - s[y]] + f[y]);
		for (i = f[y]; i <= s[x]; ++i) down(nxt[i], cur[i - f[y]] + s[y]);
	}
	f[x] = *std::min_element(nxt, nxt + (s[x] + 1));
}

int main() {
	int i, x;
	scanf("%d", &n);
	for (i = 2; i <= n; ++i) scanf("%d", &x), link(i, x);
	for (i = 1; i <= n; ++i) scanf("%d", s + i);
	dfs(1), puts(f[1] >= INF ? "IMPOSSIBLE" : "POSSIBLE");
	return 0;
}