fun main(args: Array<String>) {
    val INF = 1001001001
    val (N, A, B, C) = listOfInt()
    val L = (0 until N).map { nextInt() }.sortedDescending()
    fun min(vararg v: Int) = v.asList().min()!!
    fun dfs(cur: Int, a: Int, b: Int, c: Int): Int {
        if (cur == N) return if (min(a, b, c) > 0) Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C) - 30 else INF
        val r0 = dfs(cur + 1, a, b, c)
        val r1 = dfs(cur + 1, a + L[cur], b, c) + 10
        val r2 = dfs(cur + 1, a, b + L[cur], c) + 10
        val r3 = dfs(cur + 1, a, b, c + L[cur]) + 10
        return min(r0, r1, r2, r3)
    }
    println(dfs(0, 0, 0, 0))
}
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)