import java.util.*
import java.math.*
import java.lang.Math.*

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 {
    val INF = Int.MAX_VALUE/2

    tailrec fun dfs(n: Int, a: Int, b: Int, c: Int): Int {
        if (n>=N) {
            if (a == 0 || b == 0 || c == 0) return INF
            return abs(A - a) + abs(B - b) + abs(C - c) - 30
        }

        val r = dfs(n+1, a, b, c)
        val r0 = dfs(n+1, a+L[n], b, c) + 10
        val r1 = dfs(n+1, a, b+L[n], c) + 10
        val r2 = dfs(n+1, a, b, c+L[n]) + 10
        return min(r, min(r0, min(r1, r2)))

    }

    val res = dfs(0, 0, 0, 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)
}
