#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 1005;

int f[1005][5005], fa[MAX_N], X[MAX_N];
int g[5005];

inline void chmin(int &x, int y) {
  if (x > y) x = y;
}

int main() {
  int N;
  scanf("%d", &N);
  for (int i = 2; i <= N; ++i)
    scanf("%d", &fa[i]);
  for (int i = 1; i <= N; ++i)
    scanf("%d", &X[i]);
  
  memset(f, 0x3f, sizeof f);
  for (int i = 1; i <= N; ++i) f[i][0] = 0;
  
  for (int i = N; i; --i) {
    int mn = 0x3f3f3f3f;
    for (int j = 0; j <= X[i]; ++j)
      mn = min(mn, f[i][j]);
    if (mn == 0x3f3f3f3f) {
      puts("IMPOSSIBLE");
      return 0;
    }
    
    if (fa[i]) {
      memset(g, 0x3f, sizeof g);
      for (int j = 0; j <= X[fa[i]]; ++j) {
	chmin(g[j + X[i]], f[fa[i]][j] + mn);
	chmin(g[j + mn], f[fa[i]][j] + X[i]);
      }
      memcpy(f[fa[i]], g, sizeof g);
    }
  }

  puts("POSSIBLE");
  
  return 0;
}
