#include <bits/stdc++.h>
using namespace std;
vector<long long> g[1000], x(1000);
long long rec(long long v) {
  long long INF = 111111111;
  vector<long long> dp(5010, INF);
  if (g[v].size() == 0) {
    return 0;
  }
  for (long long i = 0; i < g[v].size(); i++) {
    long long b = x[g[v][i]];
    long long w = rec(g[v][i]);
    if (w == -1) return w;
    if (i == 0) {
      if (w <= 5000) dp[w] = min(dp[w], b);
      if (b <= 5000) dp[b] = min(dp[b], w);
      continue;
    }
    for (long long j = 5000; j >= 0; j--) {
      if (dp[j] == INF) continue;
      if (j + w <= 5000) dp[j + w] = min(dp[j + w], dp[j] + b);
      if (j + b <= 5000) dp[j + b] = min(dp[j + b], dp[j] + w);
    }
  }
  long long w = INF;
  for (long long i = x[v]; i >= 0; i--) {
    w = min(w, dp[i]);
  }
  if (w == INF) return -1;
  return w;
}
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long p;
    cin >> p;
    g[--p].push_back(i);
  }
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  if (rec(0) == -1) cout << "IM";
  cout << "POSSIBLE" << endl;
  return 0;
}
