import sys 
n, A, B, C = map(int, raw_input().split())
arr = []
for i in range(n):
    arr.append(int(raw_input()))
A, B, C = sorted([A, B, C], reverse=True)
def dfs(i, a, b, c, mp):
    if i == n:
        if a > 0 and b > 0 and c > 0:
            return abs(A-a) + abs(B-b) + abs(C-c) + mp - 30
        else:
            return sys.maxint
    ret0 = dfs(i+1, a, b, c, mp)
    ret1 = dfs(i+1, a+arr[i], b, c, mp+10)
    ret2 = dfs(i+1, a, b+arr[i], c, mp+10)
    ret3 = dfs(i+1, a, b, c+arr[i], mp+10)
    return min(ret0, ret1, ret2, ret3)
print dfs(0, 0, 0, 0, 0)