#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[1005], b[1005];
long long d[1005];
vector<long long> ve[1005];
bitset<5005> bs;
int main() {
  scanf("%lld", &n);
  for (long long i = 2; i <= n; i++) {
    scanf("%lld", &a[i]);
    ve[a[i]].push_back(i);
  }
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &b[i]);
  }
  for (long long i = n; i >= 1; i--) {
    long long t = b[i];
    bs = 1;
    long long sum = 0;
    long long now = 0;
    for (long long j = 0; j < ve[i].size(); j++) {
      t -= min(b[ve[i][j]], d[ve[i][j]]);
      sum += b[ve[i][j]] + d[ve[i][j]];
      bs |= (bs << abs(b[ve[i][j]] - d[ve[i][j]]));
    }
    if (t < 0) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
    for (long long i = t; i >= 0; i--) {
      if (bs[i]) {
        now = i;
        break;
      }
    }
    d[i] = sum - now;
  }
  printf("POSSIBLE\n");
  return 0;
}
