#include <bits/stdc++.h>
using namespace std;
int N;
vector<vector<int>> v(5010);
vector<int> X(5010), mi(5010, 0);
bool dfs(int n) {
  bool ok = true;
  int s = v[n].size(), sum = 0;
  if (s == 0) return true;
  vector<int> x(s + 1, 0), m(s + 1, 0);
  for (int i = 0; i < s; i++) {
    int a = v[n][i];
    ok = (ok & dfs(a));
    x[i + 1] = X[a];
    mi[i + 1] = mi[a];
    sum += X[a] + mi[a];
  }
  if (ok) {
    vector<vector<int>> dp1(s + 1, vector<int>(X[n] + 1, 0)),
        dp2(s + 1, vector<int>(X[n] + 1, 0));
    if (x[1] <= X[n]) dp1[1][x[1]] = 1;
    if (mi[1] <= X[n]) dp2[1][mi[1]] = 1;
    for (int i = 2; i <= s; i++) {
      for (int j = 0; j <= X[n]; j++) {
        if (j + x[i] <= X[n]) {
          dp1[i][j + x[i]] = (dp1[i - 1][j] | dp2[i - 1][j]);
        }
        if (j + mi[i] <= X[n]) {
          dp2[i][j + mi[i]] = (dp1[i - 1][j] | dp2[i - 1][j]);
        }
      }
    }
    int res = -1;
    for (int j = 0; j <= X[n]; j++)
      if (dp1[s][j] || dp2[s][j]) res = j;
    if (res == -1)
      return false;
    else {
      mi[n] = sum - res;
      return true;
    }
  } else
    return false;
}
int main() {
  cin >> N;
  int p;
  for (int i = 2; i <= N; i++) {
    cin >> p;
    v[p].push_back(i);
  }
  for (int i = 1; i <= N; i++) cin >> X[i];
  cout << (dfs(1) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}
