#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   std::pair<Int, Int> f(std::vector<std::pair<Int, Int>> xs, Int z) {
      if( xs.size() == 0 ) return std::make_pair(z, 0);
      if( xs[0].first == -1 or xs[0].second == -1 ) dame();

      Int inf = 1LL << 53;
      std::vector<Int> dp1(10101, inf), dp2(10101, inf);
      dp1[xs[0].first]  = std::min(dp1[xs[0].first], xs[0].second);
      dp1[xs[0].second] = std::min(dp1[xs[0].second], xs[0].first);
      for(Int i = 1; i < (Int)xs.size(); ++i) {
         if( xs[i].first == -1 or xs[i].second == -1 ) dame();
         for(Int k = 5000; k >= 0; --k) {
            dp2[k] = inf;
            if( k-xs[i].first >= 0 )  dp2[k] = std::min(dp2[k], dp1[k-xs[i].first]+xs[i].second);
            if( k-xs[i].second >= 0 ) dp2[k] = std::min(dp2[k], dp1[k-xs[i].second]+xs[i].first);
         }
         std::swap(dp1, dp2);
      }
      for(Int i = z; i >= 0; --i) {
         if( dp1[i] < inf ) {
            return std::make_pair(i, dp1[i]);
         }
      }
      dame();
      return std::make_pair(-1, -1);
   }
   std::vector<Int> graph[1123];
   std::pair<Int, Int> dfs(Int i) {
      std::vector<std::pair<Int, Int>> xs;
      for(Int next : graph[i]) {
         auto t = dfs(next);
         if( t.first == -1 or t.second == -1 ) dame();
         xs.push_back(t);
      }
      auto xy = f(xs, ws[i]);
      return std::make_pair(ws[i], xy.second);
   }
   void dame() {
      puts("IMPOSSIBLE");
      exit(0);
      return;
   }
   std::vector<Int> ws;
   void solve() {
      Int n; scan(n);
      for(Int i = 2; i <= n; ++i) {
         Int t; scan(t);
         graph[t].push_back(i);
      }
      ws.resize(n+1);
      for(Int i = 1; i <= n; ++i) scan(ws[i]);
      auto t = dfs(1);
      auto res = t.first != -1 and t.second != -1;
      puts(res ? "POSSIBLE" : "IMPOSSIBLE");
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 580