#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 5e18;
int main() {
  long long n;
  cin >> n;
  vector<long long> p(n + 5), x(n + 5);
  for (long long i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  for (long long i = 0; i < n; i++) cin >> x[i];
  vector<vector<long long> > f(n + 5, vector<long long>(5050));
  for (long long i = n - 1; i > -1; i--) {
    for (long long j = x[p[i]]; j >= 0; j--) {
      f[p[i]][j] = min(
          x[i] <= j ? f[p[i]][j - x[i]] + f[i][x[i]] : (long long)1e9,
          f[i][x[i]] <= j ? f[p[i]][j - f[i][x[i]]] + x[i] : (long long)1e9);
    }
  }
  if (f[0][x[0]] < (long long)1e9) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
