#include <bits/stdc++.h>
using namespace std;
const int maxn = 8010, inf = 2e9;
inline int gi() {
  int o = 0, fl = 1;
  char ch = getchar();
  while (!isdigit(ch)) fl ^= ch == '-', ch = getchar();
  while (isdigit(ch)) o = o * 10 + ch - '0', ch = getchar();
  return fl ? o : -o;
}
vector<int> p[maxn];
char s[maxn];
int f[maxn], v[maxn], dp[maxn], n;
inline void dfs(int x) {
  for (int ii = 0; ii < p[x].size(); ii++) dfs(p[x][ii]);
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  for (int ii = 0; ii < p[x].size(); ii++) {
    int k = p[x][ii];
    for (int i = v[x]; ~i; --i) {
      int tmp = 2e9;
      if (i >= v[k]) tmp = min(tmp, dp[i - v[k]] + f[k]);
      if (i >= f[k]) tmp = min(tmp, dp[i - f[k]] + v[k]);
      dp[i] = tmp;
    }
  }
  for (int i = v[x]; i >= 0; i--) f[x] = min(f[x], dp[i]);
  return;
}
int main() {
  n = gi();
  for (int i = 2; i <= n; ++i) p[gi()].push_back(i);
  for (int i = 1; i <= n; ++i) v[i] = gi(), f[i] = 2e9;
  dfs(1);
  if (f[1] == 2e9) printf("IM");
  puts("POSSIBLE");
  return 0;
}
