n, a, b, c = map(int, input().split())
l = [int(input()) for i in range(n)]
def dfs(cur, q, w, e):
    if cur == n:
        return abs(a-q)+abs(b-w)+abs(c-e)-30 if min(q, w, e) != 0 else 10**18
    return min(
        dfs(cur+1, q+l[cur], w, e)+10,
        dfs(cur+1, q, w+l[cur], e)+10,
        dfs(cur+1, q, w, e+l[cur])+10,
        dfs(cur+1, q, w, e),
    )
print(dfs(0, 0, 0, 0))