n, a, b, c = map(int, input().split())
l = [int(input()) for i in range(n)]
inf = float(10**9)

def dfs(cur, aa, bb, cc):
    if cur == n:
        return abs(aa-a) + abs(bb-b) + abs(cc-c) -30 if min(a, b, c) > 0 else inf
    ret0 = dfs(cur+1, aa, bb, cc)
    ret1 = dfs(cur+1, aa + l[cur], bb, cc) + 10
    ret2 = dfs(cur+1, aa, bb + l[cur], cc) + 10
    ret3 = dfs(cur+1, aa, bb, cc + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

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