#include <bits/stdc++.h>
using namespace std;
const int N = 1007;
const int X = 5007;
int n;
vector<int> G[N];
bool dp[N][X];
int ple[2][N][X];
int x[N];
void dfs(int v) {
  memset(ple[0][v], 0x3f3f3f3f, sizeof ple[0][v]);
  memset(ple[1][v], 0x3f3f3f3f, sizeof ple[1][v]);
  ple[0][v][0] = 0;
  int curr = 0, d = 0;
  for (auto it : G[v]) {
    dfs(it);
    for (int i = X - 1; i >= 0; --i) {
      if (dp[it][i]) {
        for (int j = curr; j >= 0; --j) {
          if (j + i < X) {
            ple[d ^ 1][v][j + i] =
                min(ple[d ^ 1][v][j + i], ple[d][v][j] + x[it]);
            if (ple[d ^ 1][v][j + i] <= x[v]) curr = max(curr, j + i);
          }
          if (j + x[it] < X) {
            ple[d ^ 1][v][j + x[it]] =
                min(ple[d ^ 1][v][j + x[it]], ple[d][v][j] + i);
            if (ple[d ^ 1][v][j + x[it]] <= x[v]) curr = max(curr, j + x[it]);
          }
        }
      }
    }
    memset(ple[d][v], 0x3f3f3f3f, sizeof ple[d][v]);
    d ^= 1;
  }
  for (int i = 0; i < X; ++i) {
    if (ple[d][v][i] <= x[v]) dp[v][i] = 1;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int p;
    cin >> p;
    G[p].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    cin >> x[i];
  }
  dfs(1);
  for (int i = 0; i < X; ++i) {
    if (dp[1][i]) {
      cout << "POSSIBLE";
      return 0;
    }
  }
  cout << "IMPOSSIBLE";
}
