import java.util.*

fun main(args: Array<String>) {

    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    val A = sc.nextInt()
    val B = sc.nextInt()
    val C = sc.nextInt()
    val L = mutableListOf<Pair<Int,Int>>()//<length,ABC or not used>
    for (i in 0 until N) {
        val l = sc.nextInt()
        L.add(l to 0)
    }

    fun calc() :Int{
        var a = 0
        var b = 0
        var c = 0
        var score = 0
        for ((l,x) in L) {
            score += 10
            when (x) {
                0-> score-=10
                1-> a+=l
                2-> b+=l
                3-> c+=l
            }
        }
        if (a==0||b==0||c==0) return 100000
        score += Math.abs(a-A)+Math.abs(b-B)+Math.abs(c-C) - 30//first abc
        return score
    }

    fun search(n:Int) :Int{
        if (n == 0) return calc()
        var res = 100000
        for (i in 0 until 4) {
            L[n-1] = L[n-1].copy(second = i)
            res = Math.min (search(n-1), res)
        }
        return res
    }

    println(search(N))
}
