#include <bits/stdc++.h>
using namespace std;
int n, x[1005], p[1005], s[1005], j, k;
bitset<5005> ok[1005];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n - 1); i++) scanf("%d", p + i + 1);
  for (int i = 0; i < (n); i++) {
    scanf("%d", x + i);
    ok[i][0] = true;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (j = x[i]; j >= 0; j--)
      if (ok[i][j]) {
        k = p[i] - 1;
        ok[k] = ok[k] << (s[i] - j) | ok[k] << x[i];
        s[k] += s[i] - j + x[i];
        break;
      }
    if (j < 0) return 0 * puts("IMPOSSIBLE");
  }
  puts("POSSIBLE");
}
