#include <bits/stdc++.h>
using namespace std;
const int twx = 5e3 + 100;
const int inf = 0x3f3f3f3f;
long long read() {
  long long sum = 0;
  long long flag = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') {
      flag = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = ((sum * 10) + c - '0');
    c = getchar();
  }
  return sum * flag;
}
int n;
int xs[twx];
struct LV {
  int y;
  int Next;
} a[twx];
int Link[twx];
int len;
int asd[twx];
int qwe[2][twx];
void Insert(int x, int y) {
  a[++len].y = y;
  a[len].Next = Link[x];
  Link[x] = len;
}
void dfs(int x) {
  for (int i = Link[x]; i; i = a[i].Next) {
    int y = a[i].y;
    dfs(y);
  }
  memset(qwe[0], 0x3f, sizeof qwe[0]);
  int tmp = 0;
  qwe[tmp][0] = 0;
  for (int i = Link[x]; i; i = a[i].Next) {
    int y = a[i].y;
    tmp = 1 - tmp;
    memset(qwe[tmp], 0x3f, sizeof qwe[tmp]);
    for (int j = 0; j <= xs[tmp]; j++) {
      if (j - xs[y] >= 0) {
        qwe[tmp][j] = min(qwe[tmp][j], qwe[1 - tmp][j - xs[y]] + asd[y]);
      }
      if (j - asd[y] >= 0) {
        qwe[tmp][j] = min(qwe[tmp][j], qwe[1 - tmp][j - asd[y]] + xs[y]);
      }
    }
  }
  for (int i = 0; i <= xs[x]; i++) {
    asd[x] = min(asd[x], qwe[tmp][i]);
  }
}
void init() {
  n = read();
  for (int i = 2; i <= n; i++) {
    int p = read();
    Insert(p, i);
  }
  for (int i = 1; i <= n; i++) {
    xs[i] = read();
  }
  memset(asd, 0x3f, sizeof asd);
  dfs(1);
  if (asd[1] < inf) {
    puts("POSSIBLE");
  } else {
    puts("IMPOSSIBLE");
  }
}
int main() {
  init();
  return 0;
}
