#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int> > child(1001);
vector<int> x(1001);
int dp[1001][5001];
int cansolve(int node) {
  vector<pair<int, int> > tmpv;
  for (int i = 0; i < child[node].size(); i++) {
    int childnode = child[node][i];
    int tmp = cansolve(childnode);
    if (tmp == 1000000007) return 1000000007;
    tmpv.push_back(make_pair(tmp, x[childnode]));
  }
  if (tmpv.size() == 0) return 0;
  for (int i = 0; i < tmpv.size(); i++) {
    for (int j = 0; j <= x[node]; j++) {
      dp[i][j] = 1000000007;
    }
  }
  dp[0][tmpv[0].first] = tmpv[0].second;
  dp[0][tmpv[0].second] = tmpv[0].first;
  for (int i = 1; i < tmpv.size(); i++) {
    int fst = tmpv[i].first;
    int snd = tmpv[i].second;
    for (int j = fst; j <= x[node]; j++) {
      dp[i][j] = min(dp[i][j], dp[i - 1][j - fst] + snd);
    }
    for (int j = snd; j <= x[node]; j++) {
      dp[i][j] = min(dp[i][j], dp[i - 1][j - snd] + fst);
    }
  }
  int ans = 1000000007;
  for (int i = 0; i <= x[node]; i++) {
    ans = min(ans, dp[tmpv.size() - 1][i]);
  }
  return ans;
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    child[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  if (cansolve(0) != 1000000007)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
