import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.StreamTokenizer
import java.util.*

var minOtherCol = IntArray( 0 )
val INF = Int.MAX_VALUE / 2
var n: Int = 0
var en: IntArray = IntArray( 0 )
var e: Array<IntArray> = Array( 0, { IntArray( 0 ) } )
var X: IntArray = IntArray( 0 )

fun main(args: Array<String>) {
//    val random = Random()
//    while ( true ) {
        try {
            val st = StreamTokenizer( BufferedReader( InputStreamReader( System.`in` ) ) )
            n = st.nextInt()
//            n = random.nextInt( 1000 ) + 1
            en = IntArray( n )
            e = Array( n, { IntArray( n ) } )
            for ( i in 1 .. n - 1 ) {
                val p = st.nextInt() - 1
//                val p = random.nextInt( i )
                e[p][en[p] ++] = i
            }
            X = IntArray( n, { st.nextInt() } )
//            X = IntArray( n, { random.nextInt( 5001 ) } )
            minOtherCol = IntArray( n, { INF } )

            for ( v in n - 1 downTo 0 ) {
                if ( en[v] == 0 ) {
                    minOtherCol[v] = 0
                    continue
                }
                val can = BooleanArray( X[v] + 1 )
                can[0] = true
                var sum = 0L
                for ( i in 0 until en[v] ) {
                    val child = e[v][i]
                    sum += X[child] + minOtherCol[child]
                    for ( j in can.lastIndex downTo 0 ) {
                        if ( ! can[j] ) continue
                        can[j] = false
                        if ( j + X[child] < can.size ) can[j + X[child]] = true
//                        println( "$j $child ${minOtherCol[child]}")
                        if ( j + minOtherCol[child] < can.size ) can[j + minOtherCol[child]] = true
                    }
                }
                if ( can.none { it } ) {
                    minOtherCol[v] = INF
                    continue
                }
                minOtherCol[v] = Math.min( INF.toLong(),sum - can.lastIndexOf( true ) ).toInt()
            }
        //    dfs( 0 )
            println( if ( minOtherCol[0] < INF ) "POSSIBLE" else "IMPOSSIBLE" )
        } catch ( ex: IndexOutOfBoundsException ) {
            ex.printStackTrace()
            return
        }
//    }
}

//fun dfs( v: Int ) {
//    for ( i in 0 until en[v] ) dfs( e[v][i] )
//    if ( en[v] == 0 ) {
//        minOtherCol[v] = 0
//        return
//    }
//    val can = BooleanArray( X[v] + 1 )
//    can[0] = true
//    var sum = 0
//    for ( i in 0 until en[v] ) {
//        val child = e[v][i]
//        sum += X[child] + minOtherCol[child]
//        for ( j in can.lastIndex downTo 0 ) {
//            if ( ! can[j] ) continue
//            can[j] = false
//            if ( j + X[child] < can.size ) can[j + X[child]] = true
//            if ( j + minOtherCol[child] < can.size ) can[j + minOtherCol[child]] = true
//        }
//    }
//    if ( can.none { it } ) {
//        minOtherCol[v] = INF
//        return
//    }
//    minOtherCol[v] = sum - can.lastIndexOf( true )
//}

private fun StreamTokenizer.nextInt(): Int {
    nextToken()
    return nval.toInt()
}
