#include <bits/stdc++.h>
using namespace std;
unsigned long long over = 1000000007;
int dfs(int idx, vector<vector<int> >& child, vector<int>& x) {
  if (child[idx].size() == 0) return 0;
  vector<tuple<int, int> > c_node;
  int x_sum = 0;
  for (auto c : child[idx]) {
    int c_ans = dfs(c, child, x);
    if (c_ans == -1) return -1;
    c_node.push_back(make_tuple(c_ans, x[c]));
    x_sum += c_ans + x[c];
  }
  int dp[c_node.size()][x[idx] + 1];
  for (int j = 0; j < c_node.size(); ++j) {
    for (int i = 0; i <= x[idx]; ++i) {
      dp[j][i] = 0;
    }
  }
  dp[0][get<0>(c_node[0])] = 1;
  dp[0][get<1>(c_node[0])] = 1;
  for (int i = 1; i < c_node.size(); ++i) {
    for (int xi = 0; xi <= x[idx]; ++xi) {
      if (dp[i - 1][xi] == 0) continue;
      if (xi + get<0>(c_node[i]) <= x[idx])
        dp[i][xi + get<0>(c_node[i])] = dp[i - 1][xi];
      if (xi + get<1>(c_node[i]) <= x[idx])
        dp[i][xi + get<1>(c_node[i])] = dp[i - 1][xi];
    }
  }
  for (int i = x[idx]; i >= 0; --i) {
    if (dp[c_node.size() - 1][i] != 0) {
      return x_sum - i;
    }
  }
  return -1;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  vector<vector<int> > child(n);
  for (int i = 1; i < n; ++i) {
    int p;
    cin >> p;
    p--;
    child[p].push_back(i);
  }
  vector<int> x(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  int ans = dfs(0, child, x);
  cout << (ans != -1 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}
