N, A, B, C, *l = map(int, open(0).read().split())

INF = 1e9

def dfs(cur, a, b, c):
    if cur == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if a * b * c != 0 else INF
    
    v1 = dfs(cur + 1, a, b, c)
    v2 = dfs(cur + 1, a + l[cur], b, c) + 10
    v3 = dfs(cur + 1, a, b + l[cur], c) + 10
    v4 = dfs(cur + 1, a, b, c + l[cur]) + 10
    
    return min(v1, v2, v3, v4)

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