#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
vector<int> tree[N];
int v[N], dp[5 * N], f[N], n;
void dfs(int x) {
  for (auto vv : tree[x]) dfs(vv);
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  for (auto vv : tree[x]) {
    for (int i = v[x]; i >= 0; i--) {
      int tmp = 0x3f3f3f3f;
      if (i >= v[vv]) tmp = min(tmp, dp[i - v[vv]] + f[vv]);
      if (i >= f[vv]) tmp = min(tmp, dp[i - f[vv]] + v[vv]);
      dp[i] = min(tmp, dp[i]);
    }
  }
  for (int i = v[x]; i >= 0; i--) f[x] = min(f[x], dp[i]);
}
int main() {
  memset(f, 0x3f, sizeof(f));
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    tree[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
  }
  dfs(1);
  if (f[1] < 0x3f3f3f3f) {
    printf("POSSIBLE\n");
  } else {
    printf("IMPOSSIBLE\n");
  }
  return 0;
}
