#include <bits/stdc++.h>
using namespace std;
template <typename T>
static ostream& operator<<(ostream& stream, const vector<T>& t);
template <typename T>
static istream& read(T, T, istream& = cin);
struct _print {
  string sep, end;
  bool space;
  ostream& stream;
  _print(string _sep = " ", string _end = "\n", ostream& _stream = cout)
      : sep(_sep), end(_end), space(false), stream(_stream) {}
  ~_print() { stream << end; }
  template <typename T>
  _print& operator,(const T& t) {
    if (space) stream << sep;
    space = true;
    stream << t;
    return *this;
  }
};
const int N = 1005, K = 5001;
vector<int> adj[N];
int x[N], dp[N];
void dfs(int u) {
  int must_take = 0, total = 0;
  bitset<K> can_make(1);
  for (int v : adj[u]) {
    dfs(v);
    int a = dp[v], b = x[v];
    if (a > b) swap(a, b);
    must_take += a;
    can_make |= can_make << (b - a);
    total += a + b;
  }
  int best = -1;
  if (x[u] < must_take) {
    _print(), "IMPOSSIBLE";
    exit(0);
  }
  for (int i = 0; i <= x[u] - must_take; ++i)
    if (can_make[i]) best = i;
  dp[u] = total - best;
}
void __() {
  memset(dp, -1, sizeof dp);
  int n;
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int p;
    cin >> p;
    adj[p].push_back(i);
  }
  for (int i = 1; i <= n; ++i) cin >> x[i];
  dfs(1);
  _print(), "POSSIBLE";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);
  __();
}
