#include <bits/stdc++.h>
using namespace std;
struct fun {
  int low, high;
  int lh;
} a[1005];
vector<int> v[1005];
const int inf = 10000009;
int flog = 0;
int dp[5000005], x[1005];
int dfs(int u) {
  int n = v[u].size();
  if (n) {
    int sum = 0, Ans = 0;
    for (int i = 0; i < n; i++)
      sum += dfs(v[u][i]), Ans += a[v[u][i]].high + a[v[u][i]].high;
    if (sum > x[u]) {
      flog = 1;
      return inf;
    }
    int m = x[u] - sum;
    for (int i = 0; i <= m; i++) dp[i] = 0;
    for (int i = 0; i < n; i++) {
      int xx = v[u][i];
      for (int j = m; j >= a[xx].lh; j--)
        dp[j] = max(dp[j], dp[j - a[xx].lh] + a[xx].lh);
    }
    int Max = 0;
    for (int i = 0; i <= m; i++) Max = max(Max, dp[i]);
    int t = sum + Max;
    Ans -= t;
    a[u].high = max(Ans, x[u]);
    a[u].low = min(Ans, x[u]);
    a[u].lh = a[u].high - a[u].low;
  }
  return a[u].low;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int xx;
    scanf("%d", &xx);
    v[xx].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  for (int i = 1; i <= n; i++)
    if (v[i].size() == 0) {
      a[i].high = a[i].lh = x[i];
      a[i].low = 0;
    }
  dfs(1);
  if (flog)
    printf("IMPOSSIBLE\n");
  else
    printf("POSSIBLE\n");
  return 0;
}
