#include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}
const int N = 1007;
const int INF = 1e9 + 7;
int n, p[N], T[N], sz[N], dp[2][N][N];
vector<int> G[N];
int dfs(int v) {
  sz[v] = 1;
  vector<long long> syn;
  for (auto u : G[v]) sz[v] += dfs(u), syn.push_back(T[u]);
  vector<int> pre0(sz[v] + 1, INF), pre1(sz[v] + 1, INF);
  vector<int> dp0(sz[v] + 1, INF), dp1(sz[v] + 1, INF);
  pre0[1] = pre1[0] = 0;
  for (auto u : G[v]) {
    for (int i = 0; i <= sz[v]; i++) {
      for (int j = 0; j <= min(sz[u], i); j++) {
        dp0[i] = min({dp0[i], dp[0][u][j] + pre0[i - j], T[u] + pre0[i - j]});
        dp1[i] = min({dp1[i], T[u] + pre1[i - j], dp[1][u][j] + pre1[i - j]});
      }
    }
    swap(dp0, pre0), swap(dp1, pre1);
    fill((dp0).begin(), (dp0).end(), INF),
        fill((dp1).begin(), (dp1).end(), INF);
  }
  pre1[sz[v]] = INF;
  syn.push_back(0);
  sort((syn).begin(), (syn).end());
  for (int i = 1; i < (int)(syn).size(); i++) syn[i] += syn[i - 1];
  syn.push_back(syn.back());
  for (int i = 0; i <= sz[v]; i++) {
    dp[0][v][i] = pre0[i];
    dp[1][v][i] = pre1[i];
    if (syn[i] > T[v]) dp[0][v][i] = INF;
    if (syn[sz[v] - i] > T[v]) dp[1][v][i] = INF;
  }
  return sz[v];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
    G[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) cin >> T[i];
  dfs(1);
  for (int i = 0; i <= n; i++) {
    if (dp[0][1][i] != INF) {
      cout << "POSSIBLE\n";
      return 0;
    }
    if (dp[1][1][i] != INF) {
      cout << "POSSIBLE\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE\n";
  return 0;
}
