#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmax(T& a, const T& b) {
  return a < b ? (a = b, true) : false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  return b < a ? (a = b, true) : false;
}
int N;
const int MAX_N = 1000, MAX_X = 5017;
vector<int> edge[MAX_N];
int A[MAX_N];
deque<bool> dp[MAX_N];
int mn[MAX_N];
bool dfs(int curr) {
  dp[curr].assign(MAX_X, false);
  dp[curr][0] = true;
  bool res = true, isLeaf = true;
  int sum = 0;
  for (const auto& it : edge[curr]) {
    res &= dfs(it);
    deque<bool> _dp = dp[curr];
    fill(dp[curr].begin(), dp[curr].end(), false);
    for (int i = 0; i < MAX_X; i++)
      if (_dp[i]) {
        dp[curr][min(MAX_X - 1, i + mn[it])] = true;
        dp[curr][min(MAX_X - 1, i + A[it])] = true;
      }
    sum += mn[it] + A[it];
    isLeaf = false;
  }
  if (isLeaf) {
    mn[curr] = 0;
  } else {
    bool ok = false;
    for (int i = int(0); i < int(MAX_X); i++)
      if (dp[curr][i] && A[curr] >= sum - i) {
        mn[curr] = i;
        ok = true;
        break;
      }
    res &= ok;
  }
  return res;
}
int main() {
  scanf("%d", &N);
  for (int i = int(1); i < int(N); i++) {
    int u;
    scanf("%d", &u);
    u--;
    edge[u].push_back(i);
  }
  for (int i = int(0); i < int(N); i++) {
    scanf("%d", &A[i]);
  }
  puts(dfs(0) ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}
