#include <bits/stdc++.h>
using namespace std;
namespace SHENZHEBEI {
static const int GYN = 2333333;
char SZB[GYN], *SS = SZB, *TT = SZB;
inline char gc() {
  if (SS == TT) {
    TT = (SS = SZB) + fread(SZB, 1, GYN, stdin);
    if (SS == TT) return '\n';
  }
  return *SS++;
}
inline long long read() {
  long long x = 0, g = 1;
  char ch = gc();
  for (; !isdigit(ch); ch = gc())
    if (ch == '-') g = -1;
  for (; isdigit(ch); ch = gc()) x = x * 10 - 48 + ch;
  return x * g;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline char readchar() {
  char ch = gc();
  for (; isspace(ch); ch = gc())
    ;
  return ch;
}
inline long long readstr(char *s) {
  char ch = gc();
  int cur = 0;
  for (; isspace(ch); ch = gc())
    ;
  for (; !isspace(ch); ch = gc()) s[cur++] = ch;
  s[cur] = '\0';
  return cur;
}
void Print(long long *a, int s, int t) {
  for (int i = int(s); i <= int(t); ++i) printf("%lld ", a[i]);
}
void Print(int *a, int s, int t) {
  for (int i = int(s); i <= int(t); ++i) printf("%d ", a[i]);
}
void Print(char *a, int s, int t) {
  for (int i = int(s); i <= int(t); ++i) putchar(a[i]);
}
void writeln(long long x) {
  write(x);
  puts("");
}
}  // namespace SHENZHEBEI
using namespace SHENZHEBEI;
vector<long long> g[1010];
long long a[1010], h[1010], n;
bitset<5010> f;
void dfs(long long x) {
  long long sum = 0;
  f.reset();
  f[0] = 1;
  for (int i = int(0); i < int(g[x].size()); ++i) dfs(g[x][i]);
  for (int i = int(0); i < int(g[x].size()); ++i) {
    f = (f << a[g[x][i]]) | (f << h[g[x][i]]);
    sum += a[g[x][i]] + h[g[x][i]];
  }
  for (int i = int(a[x]); i >= int(0); --i)
    if (f[i]) {
      h[x] = sum - i;
      return;
    }
  puts("IMPOSSIBLE");
  exit(0);
}
int main() {
  n = read();
  for (int i = int(2); i <= int(n); ++i) g[read()].push_back(i);
  for (int i = int(1); i <= int(n); ++i) a[i] = read();
  dfs(1);
  puts("POSSIBLE");
}
