import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.StreamTokenizer

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>) {
    try {
        val st = StreamTokenizer( BufferedReader( InputStreamReader( System.`in` ) ) )
        n = st.nextInt()
        en = IntArray( n )
        e = Array( n, { IntArray( n ) } )
        for ( i in 1 .. n - 1 ) {
            val p = st.nextInt() - 1
            e[p][en[p] ++] = i
        }
        X = IntArray( n, { st.nextInt() } )
        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 = 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
                continue
            }
            minOtherCol[v] = sum - can.lastIndexOf( true )
        }
    //    dfs( 0 )
        println( if ( minOtherCol[0] < INF ) "POSSIBLE" else "IMPOSSIBLE" )
    } catch ( ex: IndexOutOfBoundsException ) {
        var i = 0
        while ( true ) {
            i ++
        }
    }
}

//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()
}
