#include <bits/stdc++.h>
using namespace std;
int p = 1000000007;
long long kai_size = 1000001;
vector<long long> kai(kai_size, 1);
vector<long long> ink(kai_size, 1);
vector<long long> dist;
bitset<5000> smt;
bitset<5000> zero;
bitset<5000> smt2;
long long RE() {
  vector<long long> v(3, 2);
  return v.at(4);
}
long long ru(long long a, long long r) {
  if (r == 0) {
    return 1;
  }
  long long ans = ru(a, r / 2);
  ans *= ans;
  ans %= p;
  if (r % 2 == 1) {
    ans *= a;
  }
  return ans % p;
}
long long inv(long long a) { return ru(a, p - 2); }
void make_kai() {
  for (long long i = 0; i < kai_size - 1; i++) {
    kai[i + 1] = (kai[i] * (i + 1)) % p;
  }
  for (long long i = 0; i < kai_size; i++) {
    ink[i] = inv(kai[i]);
  }
}
long long com(long long n, long long r) {
  if (r < 0 || n < r) {
    return 0;
  }
  long long ans = kai[n] * ink[r];
  ans %= p;
  ans *= ink[n - r];
  ans %= p;
  return ans;
}
vector<long long> dis(long long mid1, vector<vector<long long>> &way) {
  long long n = way.size();
  vector<long long> dist(n, -1);
  dist[mid1] = 0;
  queue<long long> q;
  q.push(mid1);
  while (!q.empty()) {
    long long st = q.front();
    q.pop();
    for (long long i = 0; i < way[st].size(); i++) {
      long long to = way[st][i];
      if (dist[to] == -1) {
        dist[to] = dist[st] + 1;
        q.push(to);
      }
    }
  }
  return dist;
}
pair<long long, long long> most_far(long long now, long long n,
                                    vector<vector<long long>> &way) {
  vector<long long> dist1 = dis(now, way);
  pair<long long, long long> ans = make_pair(-1, 0);
  for (long long i = 0; i < n; i++) {
    if (dist1[i] > ans.first) {
      ans = make_pair(dist1[i], i);
    }
  }
  return ans;
}
long long per(long long a, long long b) {
  long long ans = a % b;
  if (ans < 0) {
    ans += b;
  }
  return ans;
}
vector<long long> uni(vector<long long> &v) {
  sort(v.begin(), v.end());
  vector<long long> ans(1, v[0]);
  for (long long i = 1; i < v.size(); i++) {
    if (v[i] != v[i - 1]) {
      ans.push_back(v[i]);
    }
  }
  v = ans;
  return v;
}
long long s_gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return s_gcd(b, a % b);
}
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  return s_gcd(a, b);
}
bool is_prime(long long i) {
  for (long long j = 2; j * j <= i; j++) {
    if (i % j == 0) {
      return false;
    }
  }
  return true;
}
long long get(long long i, long long j, vector<vector<long long>> &ans) {
  long long n = ans.size();
  if (i < 0 || n <= i || j < 0 || n <= j) {
    return 1;
  }
  return ans[i][j];
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
void del(vector<long long> &v, long long a) {
  vector<long long> ans;
  for (auto x : v) {
    if (x != a) {
      ans.push_back(x);
    }
  }
  v = ans;
}
void sz_tree(long long ce0, vector<vector<pair<long long, long long>>> &chi,
             vector<long long> &sz) {
  for (auto x : chi[ce0]) {
    sz_tree(x.first, chi, sz);
    sz[ce0] += sz[x.first];
  }
}
long long max1(vector<long long> &a, long long lim) {
  smt[0] = 1;
  for (auto x : a) {
    smt |= (smt << x);
  }
  long long ans = 0;
  for (long long i = 0; i <= lim; i++) {
    if (smt[i]) {
      ans = i;
    }
  }
  smt = zero;
  return ans;
}
bool solve(long long st, vector<vector<long long>> &chi, vector<long long> &x,
           vector<long long> &y) {
  long long sum_min = 0;
  vector<long long> diff(chi[st].size());
  long long co = 0;
  long long all_sum = 0;
  for (auto to : chi[st]) {
    if (!solve(to, chi, x, y)) {
      return false;
    }
    if (x[to] < y[to]) {
      swap(x[to], y[to]);
    }
    sum_min += y[to];
    diff[co] = x[to] - y[to];
    co++;
    all_sum += x[to] + y[to];
  }
  if (x[st] < sum_min) {
    return false;
  }
  y[st] = all_sum - max1(diff, x[st] - sum_min);
  return true;
}
signed main() {
  long long n;
  cin >> n;
  vector<vector<long long>> chi(n);
  for (long long i = 0; i < n - 1; i++) {
    long long p;
    cin >> p;
    chi[p - 1].push_back(i + 1);
  }
  vector<long long> x(n);
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  vector<long long> y(n);
  if (solve(0, chi, x, y)) {
    cout << "POSSIBLE" << endl;
    return 0;
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}
