#include <bits/stdc++.h>
using namespace std;
int n, x[1005], y[1005];
vector<int> a[1005];
bitset<5005> bs;
void f(int p) {
  int i, t, s = 0;
  bs = 1;
  for (i = 0; i < a[p].size(); i++) {
    t = a[p][i];
    f(t);
    bs = bs << x[t] | bs << y[t];
    s += x[t] + y[t];
  }
  for (i = x[p]; i >= 0; i--)
    if (bs[i]) break;
  if (i < 0) {
    cout << "IMPOSSIBLE";
    exit(0);
  }
  y[p] = s - i;
}
int main() {
  int i, t;
  cin >> n;
  for (i = 2; i <= n; i++) {
    scanf("%d", &t);
    a[t].push_back(i);
  }
  for (i = 1; i <= n; i++) scanf("%d", &x[i]);
  f(1);
  cout << "POSSIBLE";
  return 0;
}
