N,A,B,C = map(int,input().split())
l = [int(input()) for _ in range(N)]

def dfs(a,b,c,cnt):
#     print(a,b,c,cnt)
    if cnt >= len(l):
#         if a==0 or b==0 or c==0:
#             return 10**10
        return abs(a-A)+abs(b-B)+abs(c-C)
    
    res0 = dfs(a,b,c,cnt+1)
    res1 = dfs(a+l[cnt],        b, c       ,cnt+1) + 10
    res2 = dfs(       a, b+l[cnt], c       ,cnt+1) + 10
    res3 = dfs(       a,        b, c+l[cnt],cnt+1) + 10
    
    return min(res0,res1,res2,res3)

print(dfs(0,0,0,0)-30)