#include <bits/stdc++.h>
using namespace std;
int n, Fa[1005], Limit[1005], dp[1005];
bool pack[1005], tmp[1005];
vector<int> vec[1005];
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &Fa[i]);
    vec[Fa[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &Limit[i]);
  }
  for (int i = n; i >= 1; i--) {
    memset(pack, false, sizeof(pack));
    memset(tmp, false, sizeof(tmp));
    pack[0] = true;
    int sum = 0;
    for (auto x : vec[i]) {
      sum += Limit[x] + dp[x];
      for (int j = 0; j <= Limit[i]; j++) {
        tmp[j] = pack[j];
      }
      for (int j = Limit[i]; j >= 0; j--) {
        pack[j] = false;
        if (j >= Limit[x]) pack[j] |= tmp[j - Limit[x]];
        if (j >= dp[x]) pack[j] |= tmp[j - dp[x]];
      }
    }
    bool possible = false;
    for (int j = Limit[i]; j >= 0; j--) {
      if (pack[j]) {
        possible = true;
        dp[i] = sum - j;
        break;
      }
    }
    if (!possible) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
  }
  printf("POSSIBLE\n");
}
