#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sqr(T x) {
  return x * x;
}
template <typename T>
T abs(T x) {
  return x < 0 ? -x : x;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
bool chmin(T& x, const T& y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template <typename T>
bool chmax(T& x, const T& y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
const int MAXX = 5042;
int n;
vector<vector<int>> e;
vector<int> f;
vector<int> v;
bool dfs(int x) {
  vector<pair<int, int>> w;
  for (auto& y : e[x]) {
    if (!dfs(y)) {
      return false;
    }
    w.emplace_back(v[y], f[y]);
  }
  bitset<MAXX> b;
  b.reset();
  b.set(0);
  int s = 0;
  for (auto& p : w) {
    b = (b << p.first) | (b << p.second);
    s += p.first + p.second;
  }
  for (int i = v[x]; i >= 0; --i) {
    if (b.test(i)) {
      f[x] = s - i;
      return true;
    }
  }
  return false;
}
int main(int, char**) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  while (cin >> n) {
    e.resize(n);
    for (int i = 0; i < n; ++i) {
      e.clear();
    }
    for (int i = 1; i < n; ++i) {
      int x;
      cin >> x;
      --x;
      e[x].push_back(i);
    }
    v = vector<int>(n, 0);
    for (int i = 0; i < n; ++i) {
      cin >> v[i];
    }
    f = vector<int>(n, 0);
    cout << (dfs(0) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  }
  cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec"
       << endl;
  return 0;
}
