#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
const int maxm = 5010;
const int oo = 1000000000;
const int modulo = 1000000007;
int n;
int p[maxn], l[maxn], r[maxn];
vector<int> adj[maxn];
int f[maxm];
void input() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p[i]);
    adj[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &l[i]);
}
void init() {}
bool dfs(int first) {
  int sum = 0;
  int sumn = 0;
  for (int i = 0; i < adj[first].size(); i++) {
    if (!dfs(adj[first][i])) return false;
    sumn += min(l[adj[first][i]], r[adj[first][i]]);
    sum += l[adj[first][i]] + r[adj[first][i]];
  }
  if (sumn > l[first]) return false;
  f[sumn] = 1;
  for (int i = 1; i <= l[first]; i++) f[i] = 0;
  for (int i = 0; i < adj[first].size(); i++)
    for (int j = l[first]; j >= 0; j--)
      if (f[j] == 1 && j + abs(l[adj[first][i]] - r[adj[first][i]]) <= l[first])
        f[j + abs(l[adj[first][i]] - r[adj[first][i]])] = 1;
  int i = l[first];
  while (f[i] == 0) i--;
  r[first] = sum - i;
  return true;
}
void solve() {
  if (dfs(1))
    cout << "POSSIBLE";
  else
    cout << "IMPOSSIBLE";
}
void output() {}
int main() {
  std::ios::sync_with_stdio(false);
  input();
  init();
  solve();
  output();
  return (0);
}
