#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T> v) {
  for (int i = 0; i < (int)(v.size()); ++i) {
    if (i) os << ", ";
    os << v[i];
  }
  return os;
}
template <typename T>
T& max(T& a, T& b) {
  if (a >= b) return a;
  return b;
}
template <typename T>
T& min(T& a, T& b) {
  if (a < b) return a;
  return b;
}
template <typename T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;
int P[1010], X[1010];
int sum[1010];
bool dp1[5010][2], dp2[5010][2];
bool ok[1010];
vector<pii> arr;
vector<int> G[1010];
bool is_leaf(int i) { return G[i].size() == 0; }
void build_sum(int cur = 0) {
  if (is_leaf(cur)) {
    sum[cur] = X[cur];
    return;
  }
  sum[cur] += X[cur];
  for (int i : G[cur]) {
    build_sum(i);
    sum[cur] += sum[i];
  }
}
void dfs(int cur = 0) {
  if (is_leaf(cur)) {
    ok[cur] = true;
    return;
  }
  arr.clear();
  for (int i : G[cur]) {
    dfs(i);
    arr.push_back(pii(X[i], sum[i] - X[i]));
  }
  memset(dp1, false, sizeof(dp1));
  memset(dp2, false, sizeof(dp2));
  dp1[0][0] = dp1[0][1] = true;
  for (int i = 0; i < (int)(arr.size()); ++i) {
    for (int j = 0; j < (int)(5005); ++j) {
      if (j + arr[i].first <= 5000)
        dp2[j + arr[i].first][0] = (dp1[j][0] || dp1[j][1]);
      if (j + arr[i].second <= 5000)
        dp2[j + arr[i].second][1] = (dp1[j][0] || dp1[j][1]);
    }
    for (int j = 0; j < (int)(5005); ++j)
      swap(dp1[j][0], dp2[j][0]), swap(dp1[j][1], dp2[j][1]);
    memset(dp2, false, sizeof(dp2));
  }
  for (int i = 0; i <= X[cur]; ++i) {
    if (dp1[i][0] || dp1[i][1]) {
      ok[cur] = true;
      break;
    }
  }
}
signed main() {
  int N;
  cin >> N;
  if (N == 1) {
    cout << "POSSIBLE" << endl;
    return 0;
  }
  for (int i = 1; i < N; ++i) {
    cin >> P[i], P[i]--;
    G[P[i]].push_back(i);
  }
  for (int i = 0; i < (int)(N); ++i) cin >> X[i];
  build_sum();
  dfs();
  bool ans = true;
  for (int i = 0; i < (int)(N); ++i) {
    ans &= ok[i];
  }
  cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
