#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.14159265359;
long long MOD = (long long)10939;
const long long MAXN = (long long)1e3 + 10;
const int X = 5001;
const long long INF = (long long)INT_MAX >> 2;
const long long LOG = 20;
int p[MAXN], x[MAXN];
vector<int> G[MAXN];
int dp[MAXN][X + 10];
int ndp[X + 10];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = 1; i <= n; i++) dp[i][0] = 0;
  for (int i = n; i >= 2; i--) {
    memset(ndp, 31, sizeof ndp);
    for (int j = 1; j <= X; j++) {
      if (dp[i][j] <= x[i]) {
        for (int k = 0; k <= X; k++) {
          ndp[min(k + j, X)] = min(ndp[min(k + j, X)], dp[p[i]][k] + x[i]);
          ndp[min(k + x[i], X)] = min(ndp[min(k + x[i], X)], dp[p[i]][k] + j);
        }
      }
    }
    for (int j = 0; j <= X; j++) dp[p[i]][j] = ndp[j];
  }
  for (int i = 1; i <= X; i++)
    if (dp[1][i] <= x[1]) return cout << "POSSIBLE", 0;
  cout << "IMPOSSIBLE";
  return 0;
}
