#include <bits/stdc++.h>
const long long INF = (long long)1e18 + 123;
const int inf = (int)2e9 + 123;
const int mod = 1e9 + 7;
using namespace std;
int n;
vector<int> g[5011];
int x[5011], y[5011];
void dfs(int v = 1) {
  vector<int> dp(x[v] + 1), d(x[v] + 1);
  for (int i = 0; i <= x[v]; i++) {
    dp[i] = inf;
  }
  dp[0] = 0;
  for (auto to : g[v]) {
    dfs(to);
    d = dp;
    for (int i = 0; i <= x[v]; i++) {
      dp[i] = inf;
    }
    int a = x[to], b = y[to];
    for (int i = 0; i <= x[v]; i++) {
      if (i + a <= x[v]) dp[i + a] = min(dp[i + a], d[i] + b);
      if (i + b <= x[v]) dp[i + b] = min(dp[i + b], d[i] + a);
    }
  }
  y[v] = inf;
  for (int i = 0; i <= x[v]; i++) {
    y[v] = min(y[v], dp[i]);
  }
}
int main() {
  unsigned int FOR;
  asm("rdtsc" : "=A"(FOR));
  srand(FOR);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int a;
    cin >> a;
    g[a].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> x[i];
  dfs();
  if (y[1] < inf) {
    cout << "POSSIBLE";
  } else
    cout << "IMPOSSIBLE";
  return 0;
}
