#include <bits/stdc++.h>
using namespace std;
int n, x[1005];
vector<int> g[1005];
int m[5005];
bool c = true;
void dfs(int v) {
  int p[5005];
  for (int i = 0; i <= 5001; i++) p[i] = 10000;
  p[0] = 0;
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    dfs(u);
    int r[5005];
    for (int j = 0; j <= 5001; j++) r[j] = 10000;
    for (int j = 0; j <= 5001; j++) {
      if (p[j] < 10000) {
        r[min(j + x[u], 5001)] = min(r[min(j + x[u], 5001)], p[j] + m[u]);
        r[min(j + m[u], 5001)] = min(r[min(j + m[u], 5001)], p[j] + x[u]);
      }
    }
    for (int j = 0; j <= 5000; j++) p[j] = r[j];
  }
  m[v] = 10000;
  for (int i = x[v]; i >= 0; i--) {
    m[v] = min(m[v], p[i]);
  }
  if (m[v] >= 10000) c = false;
}
int main(void) {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a;
    cin >> a;
    g[--a].push_back(i);
  }
  for (int i = 0; i < n; i++) cin >> x[i];
  dfs(0);
  if (c)
    cout << "POSSIBLE\n";
  else
    cout << "IMPOSSIBLE\n";
}
