n,a,b,c=[int(i) for i in input().split()]
l = [int(input()) for _ in range(n)]
INF=10**9

def dfs(times,A,B,C):
    if times==n:
        return abs(A-a)+abs(B-b)+abs(C-c)- 30 if min(A,B,C)>0 else INF
    non_ans=dfs(times+1,A,B,C)
    a_ans=dfs(times+1,A+l[times],B,C)+10
    b_ans=dfs(times+1,A,B+l[times],C)+10
    c_ans=dfs(times+1,A,B,C+l[times])+10
    return min(non_ans,a_ans,b_ans,c_ans)

print(dfs(0,0,0,0))
