N, A, B, C = map(int, input().split())

length = [0] * N

for i in range(N):
    length[i] = int(input())

inf = 10 ** 9

def dfs(pos, a, b, c):
    if pos == N:
        if min(a, b, c) > 0:
            #a = 0, b = 0, c = 0だったら題意が成立しない
            return abs(a - A) + abs(b - B) + abs(c - C) - 30
        else:
            return inf
    
    ret1 = dfs(pos + 1, a, b, c)
    ret2 = dfs(pos + 1, a + length[pos], b, c) + 10
    ret3 = dfs(pos + 1, a, b + length[pos], c) + 10
    ret4 = dfs(pos + 1, a, b, c + length[pos]) + 10
    return min(ret1, ret2, ret3, ret4)
    
dfs(0, 0, 0, 0)