import java.util.*
import java.math.*
import java.lang.Math.*
import kotlin.collections.ArrayList

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private val MOD = 1e9.toLong()+7



fun solveC(N: Int, A:Int, B:Int, C:Int, L:List<Int>): Int {
    var res = Int.MAX_VALUE

    val X = ArrayList<Int>()
    val Y = ArrayList<Int>()
    val Z = ArrayList<Int>()

    fun dfs(n: Int) {
        if (n>=N) {
            if (X.size == 0 || Y.size == 0 || Z.size == 0) return

            var cost = (X.size-1 + Y.size-1 + Z.size-1) * 10
            cost += abs(A-X.sum()) + abs(B- Y.sum()) + abs(C - Z.sum())
            res = min(res, cost)
            return
        }

        for(i in 0 until 4) {
            when (i) {
                0-> {
                    X.add(L[n])
                }
                1 -> {
                    Y.add(L[n])
                }
                2 -> {
                    Z.add(L[n])
                }
            }

            dfs(n + 1)

            when (i) {
                0-> {
                    X.removeAt(X.lastIndex)
                }
                1 -> {
                    Y.removeAt(Y.lastIndex)
                }
                2 -> {
                    Z.removeAt(Z.lastIndex)
                }
            }
        }
    }

    dfs(0)

    return res
}


fun main(args: Array<String>) {
    val (N,A,B,C) = readListInt()
    val L = Array<Int>(N){0}
    for(i in 0 until N) {
        L[i] = readInt()
    }

    val ans = solveC(N, A, B, C, L.toList())

    println(ans)
}
