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

l = [0 for _ in range(n)]

for i in range(n):
    l[i] = int(input())


def dfs(count, a, b, c):
    if count == n:
        if a == 0 or b == 0 or c == 0:
            return 1000
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    else:
        return min(dfs(count + 1, a, b, c),
                   dfs(count + 1, a + l[count], b, c) + 10,
                   dfs(count + 1, a, b + l[count], c) + 10,
                   dfs(count + 1, a, b, c + l[count]) + 10,
                   )


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