#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
template <typename T, typename T2>
inline void _max(T &a, T2 b) {
  a = max((T)a, (T)b);
}
template <typename T, typename T2>
inline void _min(T &a, T2 b) {
  a = min((T)a, (T)b);
}
const int MAX = 5010;
vector<int> g[MAX];
int n, x[MAX], m[MAX];
bool dfs(int v) {
  if (g[v].empty()) {
    m[v] = 0;
    return true;
  }
  bool poss = true;
  int xm[MAX];
  memset(xm, INF, sizeof(xm));
  bool fp = false;
  for (auto &to : g[v]) {
    poss &= dfs(to);
    if (!fp) {
      _min(xm[x[to]], m[to]);
      _min(xm[m[to]], x[to]);
      fp = true;
    } else
      for (int vx = x[v]; vx >= 0; vx--) {
        if (vx + x[to] < MAX) _min(xm[vx + x[to]], xm[vx] + m[to]);
        if (vx + m[to] < MAX) _min(xm[vx + m[to]], xm[vx] + x[to]);
      }
  }
  m[v] = INF;
  for (int vx = 0; vx <= x[v]; vx++) _min(m[v], xm[vx]);
  poss &= m[v] != INF;
  return poss;
}
void clear() {
  for (int i = 0; i < MAX; i++) g[i].clear();
}
void read() {
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    p--;
    g[p].push_back(i);
  }
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
}
void solve() {
  bool res = dfs(0);
  printf(res ? "POSSIBLE\n" : "IMPOSSIBLE\n");
}
int main() {
  while (scanf("%d", &n) == 1) {
    clear();
    read();
    solve();
    return 0;
  }
  return 0;
}
