#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int MAX_N = 1010;
const int MAX_X = 5010;
int N;
vector<int> edges[MAX_N];
vector<int> X;
bool dp[MAX_N][MAX_X];
int dfs(int pos) {
  if (edges[pos].empty()) {
    return 0;
  }
  vector<int> x, y;
  int result = 0;
  for (const auto &next : edges[pos]) {
    int tmpx = X[next];
    int tmpy = dfs(next);
    if (tmpy == -1) {
      return -1;
    }
    x.push_back(tmpx);
    y.push_back(tmpy);
    result += tmpx + tmpy;
  }
  int M = x.size();
  int W = X[pos];
  memset(dp, false, sizeof(dp));
  dp[0][0] = true;
  for (int i = 0; i < M; i++) {
    for (int j = 0; j <= W; j++) {
      if (not dp[i][j]) continue;
      if (j + x[i] <= W) {
        dp[i + 1][j + x[i]] |= true;
      }
      if (j + y[i] <= W) {
        dp[i + 1][j + y[i]] |= true;
      }
    }
  }
  int tmp = -1;
  for (int j = 0; j <= W; j++) {
    if (dp[M][j]) {
      tmp = j;
      return tmp;
    }
  }
  if (tmp == -1) {
    return -1;
  }
  return result - tmp;
}
int main() {
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int x;
    cin >> x;
    x--;
    edges[x].push_back(i + 1);
  }
  X.resize(N);
  for (auto &val : X) {
    cin >> val;
  }
  if (dfs(0) != -1) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
