#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e3 + 100;
const int mod = 1e9 + 7;
int n;
vector<int> G[MAXN];
int val[MAXN];
bool flag;
int color[MAXN][2];
int op[MAXN][2];
void dfs(int u, int pa) {
  if (!flag) return;
  for (auto v : G[u]) {
    if (v == pa) continue;
    dfs(v, u);
  }
  if (!flag) return;
  for (int i = 0; i < 2; i++) {
    int sum = 0;
    int opsum = 0;
    vector<int> tmp;
    for (auto v : G[u]) {
      if (v == pa) continue;
      if (color[v][i] == 1 && color[v][i ^ 1] == 0) {
        sum += val[v];
        opsum += op[v][i ^ 1];
      } else if (color[v][i] == 1 && color[v][i ^ 1] == 1) {
        tmp.push_back(v);
      } else if (color[v][i] == 0 && color[v][i ^ 1] == 1) {
        sum += op[v][i];
        opsum += val[v];
      }
    }
    if (sum > val[u]) {
      color[u][i] = 0;
    } else {
      color[u][i] = 1;
      int len = val[u] - sum;
      unordered_map<int, int> dp;
      dp[0] = 0;
      for (auto v : tmp) {
        unordered_map<int, int> other;
        for (auto elem : dp) {
          int x = elem.first, y = elem.second;
          if (x + val[v] <= len) {
            int ttt = x + val[v];
            if (!other.count(ttt))
              other[ttt] = y + op[v][i ^ 2];
            else if (other[ttt] > y + op[v][i ^ 2])
              other[ttt] = y + op[v][i ^ 2];
          }
          if (x + op[v][i] <= len) {
            int ttt = x + op[v][i];
            if (!other.count(ttt))
              other[ttt] = y + val[v];
            else if (other[ttt] > y + val[v])
              other[ttt] = y + val[v];
          }
        }
        swap(dp, other);
      }
      int ans = ((int)0x3f3f3f3f);
      for (auto elem : dp) {
        ans = min(ans, elem.second);
      }
      if (ans == ((int)0x3f3f3f3f) && G[u].size() == 1 && u != 1) {
        op[u][i ^ 1] = opsum;
      } else if (ans == ((int)0x3f3f3f3f)) {
        color[u][i] = 0;
      } else
        op[u][i ^ 1] = opsum + ans;
    }
  }
  if (color[u][0] == 0 && color[u][1] == 0) flag = 0;
}
int main() {
  scanf("%d", &n);
  flag = 1;
  memset(color, -1, sizeof(color));
  for (int i = 2; i <= n; i++) {
    int v;
    scanf("%d", &v);
    G[i].push_back(v);
    G[v].push_back(i);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  dfs(1, 1);
  flag ? puts("POSSIBLE") : puts("IMPOSSIBLE");
}
