#include <bits/stdc++.h>
using namespace std;
long long n;
vector<vector<long long>> arc(2222);
vector<vector<long long>> barc(2222);
vector<long long> X(2222);
vector<long long> sum(2222);
vector<long long> cnt(2222);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; i++) {
    long long a;
    cin >> a;
    arc[--a].push_back(i);
    barc[i].push_back(a);
  }
  for (int i = 0; i < n; i++) {
    cin >> X[i];
  }
  queue<long long> que;
  for (int i = 0; i < n; i++) {
    if (arc[i].size() == 0) que.push(i);
  }
  while (!que.empty()) {
    long long now = que.front();
    que.pop();
    cnt[now]++;
    if (cnt[now] < arc[now].size()) continue;
    long long s = 0;
    vector<pair<long long, long long>> nows;
    for (int i = 0; i < arc[now].size(); i++) {
      nows.push_back(
          make_pair(sum[arc[now][i]] - X[arc[now][i]], X[arc[now][i]]));
    }
    bool dp[2][5500] = {};
    dp[0][0] = true;
    for (int i = 0; i < nows.size(); i++) {
      for (int j = 0; j < X[now]; j++) {
        if (dp[i % 2][j]) {
          if (nows[i].first + j <= X[now])
            dp[(i + 1) % 2][j + nows[i].first] = true;
          if (nows[i].second + j <= X[now])
            dp[(i + 1) % 2][j + nows[i].second] = true;
        }
        dp[i % 2][j] = 0;
      }
    }
    long long ho = 1e18;
    for (int i = X[now]; i >= 0; i--) {
      if (dp[nows.size() % 2][i]) {
        ho = X[now] - i;
        break;
      }
    }
    sum[now] += ho;
    if (ho == 1e18) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    for (int i = 0; i < barc[now].size(); i++) {
      que.push(barc[now][i]);
      sum[barc[now][i]] += sum[now];
    }
  }
  cout << "POSSIBLE" << endl;
  return 0;
}
