import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    auto n = readLong();
    auto p = readLongs().map!("a-1").array;
    auto x = readLongs();

    auto children = new long[][](n, 0);
    foreach(i; iota(n-1)) {
        children[p[i]] ~= i+1;
    }

    //y(i) : node(i)のxじゃないほうの色の重みの合計の最小値
    auto y = new long[](n);
    
    bool test(long i) {
        if(children.empty()) {
            y[i] = 0;
            return true;
        }
        if(children[i].map!(a => test(a)).any!(x => !x)) {
            return false;
        }
        
        auto m = children[i].map!(ci => min(x[ci], y[ci])).array();
        auto M = children[i].map!(ci => abs(x[ci] - y[ci])).array();
        if(sum(m, 0L) > x[i]) {
            return false;
        }
        
        auto canMake = new bool[](x[i] - sum(m, 0L) + 1);
        canMake[0] = true;
        foreach(j; iota(canMake.length)) {
            foreach(Mi; M) {
                if(Mi + j >= canMake.length) {
                    continue;
                }
                canMake[Mi + j] |= canMake[j];
            }
        }
        long w = x[i] - sum(m, 0L);
        foreach(j; iota(canMake.length)) {
            if(canMake[j]) {
                w = x[i] - sum(m, 0L) - j;
            }
        }
        y[i] = sum(M, 0L) + 2*sum(m, 0L) + w - x[i];
        return true;
    }
    writeln(test(0) ? "POSSIBLE": "IMPOSSIBLE");
}

