#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007, MAX = 1003, INF = 1 << 30;
vector<int> S[MAX];
int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  for (int i = 0; i < N - 1; i++) {
    int a;
    cin >> a;
    a--;
    S[a].push_back(i + 1);
  }
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  int dp[N][2];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      dp[i][j] = 0;
    }
  }
  bool ok = true;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i].size() == 0) {
      dp[i][0] = X[i];
      dp[i][1] = 0;
    } else {
      int M = S[i].size();
      int can[M + 1][5001];
      for (int k = 0; k < M + 1; k++) {
        for (int j = 0; j < 5001; j++) {
          can[k][j] = 0;
        }
      }
      can[1][dp[S[i][0]][0]] = can[1][dp[S[i][0]][1]] = 1;
      int sum = dp[S[i][0]][0] + dp[S[i][0]][1];
      for (int k = 2; k <= M; k++) {
        int a = dp[S[i][k - 1]][0], b = dp[S[i][k - 1]][1];
        sum += (a + b);
        for (int j = 5000; j >= 0; j--) {
          if (can[k - 1][j]) can[k][j] = 1;
          if (j - a >= 0 && can[k - 1][j - a]) can[k][j] = 1;
          if (j - b >= 0 && can[k - 1][j - b]) can[k][j] = 1;
        }
      }
      int maxi = -1;
      for (int j = X[i]; j >= 0; j--) {
        if (can[M][j]) {
          maxi = j;
          break;
        }
      }
      if (maxi == -1) {
        ok = false;
      } else {
        dp[i][0] = X[i];
        dp[i][1] = sum - maxi;
      }
    }
  }
  if (ok)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
