#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 1;
int n, fa[N], tot[N], fr[N], blk[N], wht[N], c[N], cnt, head[N];
struct nd {
  int ne, to;
} e[N];
void in(int x, int y) {
  e[++cnt].to = y;
  e[cnt].ne = head[x];
  head[x] = cnt;
}
int can[5001], tmp[N];
bool dfs(int x) {
  if (!head[x]) {
    blk[x] = tot[x];
    return true;
  }
  tmp[0] = 0;
  int ret = tot[x], tot1 = 0;
  for (int i = head[x]; i; i = e[i].ne) {
    if (dfs(e[i].to)) {
      ret -= min(blk[e[i].to], wht[e[i].to]);
      if (ret < 0) return false;
      tmp[++tmp[0]] = abs(blk[e[i].to] - wht[e[i].to]);
      tot1 += blk[e[i].to] + wht[e[i].to];
    } else
      return false;
  }
  memset(can, 0, sizeof(can));
  can[0] = 1;
  for (int i = 1; i <= tmp[0]; ++i)
    for (int t = 5000; t >= tmp[i]; --t) can[t] |= can[t - tmp[i]];
  for (int i = ret; i >= 0; --i)
    if (can[i]) {
      ret -= i;
      break;
    }
  blk[x] = tot[x];
  wht[x] = tot1 + ret - blk[x];
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) scanf("%d", &fa[i]), in(fa[i], i);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &tot[i]);
  }
  if (dfs(1))
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
}
