N = gets.to_i
P = [-1, -1] + gets.split.map(&:to_i)
X = [-1] + gets.split.map(&:to_i)
$child = Array.new(N+1){[]}
(2..N).each do |i|
    $child[P[i]].push(i)
end

def rec(n)
    len = $child[n].length
    dp = Array.new(len+1){[]}
    dp[0] = [0]
    sum = 0
    len.times do |i|
        a, b = rec($child[n][i])
        sum += a+b
        dp[i].each do |c|
            dp[i+1].push(c+a) if c+a <= X[n]
            dp[i+1].push(c+b) if c+b <= X[n]
        end
    end
    if dp[len].length == 0
        puts 'IMPOSSIBLE'
        exit
    end
    return [X[n], sum-dp[len].max]
end
rec(1)
puts 'POSSIBLE'