#include <bits/stdc++.h>
using namespace std;
int t[1000];
int x[1000];
vector<int> children[1000];
bool buf[2][5001] = {};
bool update(int i) {
  auto cur = buf[0];
  auto nex = buf[1];
  for (int v = 0; v <= x[i]; v++) {
    cur[v] = false;
  }
  cur[0] = true;
  int s = 0;
  for (auto c : children[i]) {
    if (!update(c)) {
      return false;
    }
    s += t[c];
    for (int v = 0; v <= x[i]; v++) {
      nex[v] = false;
      if (v >= x[c]) {
        nex[v] |= cur[v - x[c]];
      }
      if (v >= t[c] - x[c]) {
        nex[v] |= cur[v - t[c] + x[c]];
      }
    }
    swap(nex, cur);
  }
  for (int v = x[i]; v >= 0; v--) {
    if (cur[v]) {
      t[i] = s + x[i] - v;
      return true;
    }
  }
  return false;
}
int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N; i++) {
    int p;
    cin >> p;
    p--;
    children[p].push_back(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  if (update(0)) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
