#include <bits/stdc++.h>
using namespace std;
int n;
int x[1005];
vector<int> g[1005];
int dp[1005][1005 * 5];
int get(int m, vector<pair<int, int> >& a) {
  fill(dp[0], dp[0] + m + 1, 0);
  dp[0][0] = 1;
  int sum = 0;
  for (int i = 0; i < a.size(); ++i) {
    sum += a[i].first + a[i].second;
    fill(dp[i + 1], dp[i + 1] + m + 1, 0);
    for (int j = 0; j <= m; ++j) {
      if (j >= a[i].first) dp[i + 1][j] |= dp[i][j - a[i].first];
      if (j >= a[i].second) dp[i + 1][j] |= dp[i][j - a[i].second];
    }
  }
  for (int i = m; i >= 0; --i)
    if (dp[a.size()][i]) return sum - i;
  return -1;
}
int dfs(int u) {
  vector<pair<int, int> > a(0);
  for (auto v : g[u]) {
    int ret = dfs(v);
    if (ret == -1) return -1;
    a.push_back({x[v], ret});
  }
  return get(x[u], a);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  for (int i = 1; i <= n; ++i) cin >> x[i];
  if (dfs(1) == -1) cout << "IM";
  cout << "POSSIBLE";
  return 0;
}
