fun main(args: Array<String>) {
    val (N, A, B, C) = listOfInt()
    val L = (0 until N).map { nextInt() }
    var ans = Int.MAX_VALUE
    fun calc(V: IntArray) {
        var mp = 0
        val abc = Array(4) { 0 }
        for (n in 0 until N) {
            if (V[n] == 3) continue
            if (abc[V[n]] > 0) mp += 10
            abc[V[n]] += L[n]
        }
        abc[3] = 1001001001
        mp += Math.abs(abc[0] - A) + Math.abs(abc[1] - B) + Math.abs(abc[2] - C)
        if (abc.min()!! > 0) ans = Math.min(ans, mp)
    }
    fun dfs(d: Int, v: IntArray) {
        if (d == N) calc(v)
        else for (n in 0 until 4) {
            v[d] = n
            dfs(d + 1, v)
        }
    }
    dfs(0, IntArray(N))
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)