n,a,b,c = map(int,input().split())
nu = [a,b,c]
ans = [[[0,0],[0,0],[0,0],[0,0]] for i in range(4 ** n)]
lis = [int(input()) for i in range(n)]
def to4(n):
    if int(n//4):
        return to4(n//4) + str(n%4)
    return str(n%4)
for i in range(4 ** n):
    s = to4(i).zfill(n)
    for j in range(n):
        ans[i][int(s[j])][0] += lis[j]
        ans[i][int(s[j])][1] += 1
an = 10 ** 18
for i in range(4 ** n):
    a = 0
    for num in range(3):
        a += abs(ans[i][num][0] -nu[num])
        a += max(0,ans[i][num][1]-1) * 10
    an = min(an,a)
print(an)