package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

var N, A, B, C int64
var takes = make([]int64, 0)

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}

func dfs(depth, a, b, c int64) int64 {
	if depth == N {
		if a > 0 && b > 0 && c > 0 {
			return abs(A-a) + abs(B-b) + abs(C-c) - 30
		}
		return math.MaxInt64 - 10
	}

	ret := make([]int64, 4)
	ret[0] = dfs(depth+1, a, b, c)
	ret[1] = dfs(depth+1, a+takes[depth], b, c) + 10
	ret[2] = dfs(depth+1, a, b+takes[depth], c) + 10
	ret[3] = dfs(depth+1, a, b, c+takes[depth]) + 10

	sort.Slice(ret, func(i, j int) bool { return ret[i] < ret[j] })

	return ret[0]
}

func main() {
	line := nextLine()
	parts := strings.Split(line, " ")
	N, _ = strconv.ParseInt(parts[0], 10, 64)
	A, _ = strconv.ParseInt(parts[1], 10, 64)
	B, _ = strconv.ParseInt(parts[2], 10, 64)
	C, _ = strconv.ParseInt(parts[3], 10, 64)

	for i := 0; i < int(N); i++ {
		line := nextLine()
		take, _ := strconv.ParseInt(line, 10, 64)
		takes = append(takes, take)
	}

	fmt.Println(dfs(0, 0, 0, 0))
}
