import java.math.*

fun main(args: Array<String>) {
    val (N, A, B, C) = readInputLine().split(" ").map{it.toInt()}
    
    val takes = IntArray(N)
    
    for (i in 0 until N) {
        takes[i] = readInputLine().toInt()
    }
    
    println(dfs(N, A, B, C, takes, 0, 0, 0, 0))
}

fun readInputLine(): String {
    return readLine()!!
}

fun dfs(N: Int, A: Int, B: Int, C: Int, takes: IntArray, cnt: Int, a: Int, b: Int, c: Int): Int {
    if (cnt == N) {
        return if (a == 0 || b == 0 || c == 0) 1000000000 else Math.abs(A - a) + Math.abs(B - b) + Math.abs(C - c) - 30
    }
    
    var ret = Int.MAX_VALUE
    ret = Math.min(ret, dfs(N, A, B, C, takes, cnt + 1, a + takes[cnt], b, c) + 10)
    ret = Math.min(ret, dfs(N, A, B, C, takes, cnt + 1, a, b + takes[cnt], c) + 10)
    ret = Math.min(ret, dfs(N, A, B, C, takes, cnt + 1, a, b, c + takes[cnt]) + 10)
    ret = Math.min(ret, dfs(N, A, B, C, takes, cnt + 1, a, b, c))
    
    return ret
}