def dfs(i, a, b, c, t):
    global ans
    if a*b*c > 0:
        ans = min( ans, abs(A-a)+abs(B-b)+abs(C-c)+10*(t-3) )
    if i > N - 1: return 0
    dfs(i+1,a,b,c,t)
    dfs(i+1, a + L[i], b, c, t+1)
    dfs(i+1, a, b + L[i], c, t+1)
    dfs(i+1, a, b, c + L[i], t+1)
    return ans
N, A, B, C = map(int,input().split())
L = [int(input()) for i in range(N)]
ans = 10**9
print(dfs(0,0,0,0,0))