#include <bits/stdc++.h>
int n;
int p[1005];
std::vector<int> down[1005];
int want[1005];
std::bitset<5005> other[1005];
bool bad = 0;
std::bitset<5005> k1[5005];
std::bitset<5005> k2[5005];
void dfs(int u) {
  if (down[u].empty()) {
    other[u][0] = 1;
    return;
  }
  for (int i = 0; i <= want[u]; i++) k1[i].reset();
  k1[0][0] = 1;
  for (int v : down[u]) {
    dfs(v);
    for (int i = 0; i <= want[u]; i++) k2[i].reset();
    for (int w = 0; w <= want[u]; w++) {
      if (!other[v][w]) continue;
      for (int i = 0; i <= want[u]; i++) {
        if (i + want[v] <= want[u]) {
          k2[i + want[v]] |= (k1[i] << w);
        }
        if (i + w <= want[u]) {
          k2[i + w] |= (k1[i] << want[v]);
        }
      }
    }
    for (int i = 0; i <= want[u]; i++) k1[i] = k2[i];
  }
  for (int i = 0; i <= want[u]; i++) {
    other[u] |= k1[i];
  }
  if (other[u].none()) bad = 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", p + i);
    down[p[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", want + i);
  }
  dfs(1);
  if (bad) printf("IM");
  printf("POSSIBLE\n");
}
