import java.io.BufferedInputStream
import java.io.InputStream
import java.util.StringTokenizer

const val INF = 100000000
fun solve(N: Int, A: Int, B: Int, C: Int, l: IntArray) {
    fun dfs(a: Int, b: Int, c: Int, cur: Int, merge: Int): Int = when (cur) {
        N -> {
            if (a <= 0 || b <= 0 || c <= 0) INF
            else listOf(A - a, B - b, C - c).sumBy { Math.abs(it) } + (merge - 3) * 10
        }
        else -> listOf(
            dfs(a, b, c, cur + 1, merge),
            dfs(a + l[cur], b, c, cur + 1, merge + 1),
            dfs(a, b + l[cur], c, cur + 1, merge + 1),
            dfs(a, b, c + l[cur], cur + 1, merge + 1)
        ).min()!!
    }
    println(dfs(0, 0, 0, 0, 0))
    return
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val A = sc.next().toInt()
    val B = sc.next().toInt()
    val C = sc.next().toInt()
    val l = IntArray(N)
    for (i in 0 until N) {
        l[i] = sc.next().toInt()
    }
    solve(N, A, B, C, l)
}
