N, A, B, C = map(int, input().split(" "))
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cnt, a, b, c):
    if cnt == N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF
    ret1=dfs(cnt+1,a+l[cnt],b,c)+10
    ret2=dfs(cnt+1,a,b+l[cnt],c)+10
    ret3=dfs(cnt+1,a,b,c+l[cnt])+10
    ret4=dfs(cnt+1,a,b,c)
    return min(ret1,ret2,ret3,ret4)

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