package main

import (
	"fmt"
	"math"
)

var N, A, B, C int
var l []int

func main() {
	fmt.Scan(&N, &A, &B, &C)
	l = make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&l[i])
	}
	fmt.Println(dfs(0, 0, 0, 0))

}
func dfs(i, a, b, c int) int {
	if i == N {
		if a == 0 || b == 0 || c == 0 {
			return math.MaxInt32
		}
		return Abs(a-A) + Abs(b-B) + Abs(c-C)
	}

	r := dfs(i+1, a, b, c)
	var wa, wb, wc int
	if a > 0 {
		wa = 10
	}
	if b > 0 {
		wb = 10
	}
	if c > 0 {
		wc = 10
	}
	r = Min(r, dfs(i+1, a+l[i], b, c)+wa)
	r = Min(r, dfs(i+1, a, b+l[i], c)+wb)
	r = Min(r, dfs(i+1, a, b, c+l[i])+wc)
	return r
}

func Min(a, b int) int {
	if b < a {
		return b
	}
	return a
}
