# 各たけを、A,B,C,使わないの4パターンに振り分ける
# LA = [l2,l4,l7]みたいになったら、あとは
# コストは（合成＋調整で）(len(LA)-1)*10 + abs(sum(LA)-A)
# A = 90, L! = [40,30,21] -> 20 + 1
import copy as cp
inf = 10**9
def cost(li, length):
    if len(li)==0:
        return inf
    return (len(li)-1)*10 + abs(sum(li)-length)

def search_cost(ln,assignment,length):
#     from IPython.core.debugger import Pdb; Pdb().set_trace()
    if len(ln)==0:
        costA = cost(assignment["A"], length[0])
        costB = cost(assignment["B"], length[1])
        costC = cost(assignment["C"], length[2])
        return costA + costB + costC
    val = ln[-1]
    candidate = []
    for take in assignment.keys():
        nextdic = cp.deepcopy(assignment)
        nextdic[take].append(val)
        print(nextdic)
        cand = search_cost(ln[:-1],nextdic,length)
        candidate.append(cand)
    return min(candidate)
  
  
# 実行部
N, A, B, C =map(int,input().split())
length = [A,B,C]
ln = []
assignment = {"A":[],"B":[],"C":[],"D":[]}

for i in range(N):
    a = int(input())
    ln.append(a)
   
search_cost(ln,assignment,length)