#include <bits/stdc++.h>
using namespace std;
vector<int> drogi[1010];
pair<int, int> tab[1010];
bool dfs(int where = 1) {
  int a = 0, suma = 0;
  int x;
  vector<bool> plecak(tab[where].first + 3);
  plecak[0] = 1;
  for (int i : drogi[where]) {
    if (!dfs(i)) return false;
    a += min(tab[i].first, tab[i].second);
    suma += tab[i].first + tab[i].second;
    x = abs(tab[i].first - tab[i].second);
    for (int i = 5000; i >= x; i--) {
      if (plecak[i - x]) plecak[i] = true;
    }
  }
  if (a > tab[where].first) return false;
  int jak;
  for (jak = tab[where].first - a; jak >= 0; jak--) {
    if (plecak[jak]) break;
  }
  a += jak;
  suma += tab[where].first - a;
  tab[where].second = suma - tab[where].first;
  return true;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int a, i = 2; i <= n; i++) {
    cin >> a;
    drogi[a].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> tab[i].first;
  }
  if (dfs()) {
    cout << "POSSIBLE";
  } else {
    cout << "IMPOSSIBLE";
  }
  return 0;
}
