#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, op = 1;
  char ch = 0;
  while (not isdigit(ch = getchar()))
    if (ch == '-') op = -op;
  do x = x * 10 + (ch - '0');
  while (isdigit(ch = getchar()));
  return op * x;
}
int n = 0, fa[1050], need[1050], ans[1050], sum[1050];
bool mid[1050][10050];
signed main() {
  n = read(), mid[1][0] = true;
  for (int i = 2; i <= n; i++) fa[i] = read(), mid[i][0] = true;
  for (int i = 1; i <= n; i++) need[i] = read();
  for (int i = n; i >= 1; i--) {
    ans[i] = -1;
    for (int j = min(10000, sum[i] - need[i]); j <= 10000; j++)
      if (mid[i][j]) {
        ans[i] = j;
        break;
      }
    if (ans[i] < 0 || sum[i] - ans[i] > need[i]) return (puts("IMPOSSIBLE"), 0);
    if (i == 1) break;
    for (int j = 10000; j >= 0; j--)
      if (mid[fa[i]][j]) {
        mid[fa[i]][j] = false;
        mid[fa[i]][min(10000, j + ans[i])] = true;
        mid[fa[i]][min(10000, j + need[i])] = true;
      }
    sum[fa[i]] += ans[i] + need[i];
  }
  puts("POSSIBLE");
  return 0;
}
