#include <bits/stdc++.h>
using namespace std;
long long n, h[1010], w[1010];
vector<long long> g[1010];
bool dfs(long long x, long long from) {
  vector<long long> c;
  long long base = 0, sum = 0;
  for (auto y : g[x])
    if (y != from) {
      dfs(y, x);
      base += h[y], sum += w[y];
      c.push_back(w[y] - h[y]);
    }
  if (base > h[x]) return 0;
  bool dp[5010];
  for (int i = 0; i < 5010; i++) dp[i] = 0;
  dp[0] = 1;
  for (auto cc : c) {
    for (int i = 5005 - cc; i >= 0; i--) {
      dp[i + cc] |= dp[i];
    }
  }
  long long ma = 0;
  for (int i = 0; i + base <= h[x]; i++) {
    if (dp[i]) ma = i;
  }
  ma = h[x] - (ma + base);
  sum += ma;
  w[x] = sum - h[x];
  w[x] = max(w[x], 0LL);
  if (w[x] < h[x]) swap(w[x], h[x]);
  return 1;
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    long long a;
    cin >> a;
    g[a].push_back(i);
    g[i].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
  }
  if (dfs(1, 0) == 0) cout << "IM";
  cout << "POSSIBLE" << endl;
  return 0;
}
