#A,B,Cを決めた後、heapqをやめて全探索、たぶんTLE

# 初期入力
import heapq
from itertools import combinations
import sys
input = sys.stdin.readline  #文字列では使わない
N,A,B,C = (int(i) for i in input().split())
l =[0]*N
for i in range(N):
    l[i] = int(input())

# A,B,Cと元の竹の長さの差（絶対値）
dif_A =[]
dif_B =[]
dif_C =[]
for n in range(1,N+1):
    for j in combinations(l,n):
        #dif変数の要素＝（求める長さー今回選んだ竹の長さ合計）*10**（合成魔法の回数)＝MPの消費量、
        #               選んだ竹、
        #               A or B or C(heapqするとABCが混ざるので区別に必要)
        #if n >=2:
        dif_A.append((abs(A-sum(j)) +10*(n-1),j,"A") )
        dif_B.append((abs(B-sum(j)) +10*(n-1),j,"B") )
        dif_C.append((abs(C-sum(j)) +10*(n-1),j,"C") )

#
mp =[]
for i in dif_A: 
    for j in dif_B:
        for k in dif_C:
            if set(i[1]).isdisjoint(set(j[1])) and \
                set(i[1]).isdisjoint(set(k[1])) and \
                set(j[1]).isdisjoint(set(k[1])):
                mp.append(i[0] +j[0] +k[0])
#mp.sort()

print(min(mp))