#include <bits/stdc++.h>
using namespace std;
long long N;
vector<long long> ch[1010];
long long X[1010];
bool dp[5050];
pair<long long, long long> dfs(long long cur) {
  if (ch[cur].empty()) {
    return pair<long long, long long>(X[cur], 0);
  }
  vector<pair<long long, long long> > children;
  long long sum = 0;
  for (long long i = 0; i < (ch[cur].size()); ++i) {
    pair<long long, long long> child = dfs(ch[cur][i]);
    children.push_back(child);
    sum += child.first + child.second;
  }
  memset(dp, 0, sizeof(dp));
  dp[0] = true;
  long long base = 0;
  for (pair<long long, long long> child : children) {
    long long a = child.first, b = child.second;
    long long c = max(a, b) - min(a, b);
    base += min(a, b);
    for (long long i = 0; i < (5050); ++i) {
      if (dp[i]) {
        if (i + c < 5050) {
          dp[i + c] = true;
        }
      }
    }
  }
  long long add = -1;
  for (long long i = 0; i <= X[cur] - base; ++i) {
    if (dp[i]) add = X[cur] - base - i;
  }
  if (add == -1) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  return pair<long long, long long>(X[cur], sum + add - X[cur]);
}
signed main() {
  cin >> N;
  for (long long i = 1; i < N; ++i) {
    long long p;
    cin >> p;
    --p;
    ch[p].push_back(i);
  }
  for (long long i = 0; i < (N); ++i) {
    cin >> X[i];
  }
  dfs(0);
  cout << "POSSIBLE" << endl;
}
