ri = lambda: int(eval(input()))

rl = lambda: list(map(int,input().split()))



N,A,B,C=rl()

l=[0]*N

for i in range(N):

    l[i] = ri()

ans = float('inf')

for n in range(4**N):

    a,b,c=0,0,0

    ans_ = 0

    for i in range(N):

        sn = format(n>>(2*i),'0{}b'.format(N))[-2:]

        if sn=='01':

            a+=l[i]

            ans_ += 10

        elif sn=='10':

            b+=l[i]

            ans_ += 10

        elif sn=='11':

            c+=l[i]

            ans_ += 10

    if a!=0 and b!=0 and c!=0:

        ans_ += abs(A-a)+abs(B-b)+abs(C-c) -30

        if ans > ans_:

            ans = ans_



print(ans)
ri = lambda: int(eval(input()))

rl = lambda: list(map(int,input().split()))



N,A,B,C=rl()

l=[ri() for _ in range(N)]

ans = 10**18

import itertools

for seq in itertools.product(list(range(4)),repeat=N):

    a,b,c=0,0,0

    rst = 0

    for i in range(N):

        if seq[i]==1:

            a+=l[i]

            rst+=10

        elif seq[i]==2:

            b+=l[i]

            rst+=10

        elif seq[i]==3:

            c+=l[i]

            rst+=10

    if a*b*c != 0:

        rst += abs(A-a)+abs(B-b)+abs(C-c)-30

        if ans > rst:

            ans = rst



print(ans)
ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
N, A, B, C = rl()
l = [0] * N
for i in range(N):
    l[i] = ri()
ans = float("inf")
for n in range(4**N):
    a, b, c = 0, 0, 0
    ans_ = 0
    for i in range(N):
        sn = format(n >> (2 * i), "0{}b".format(N))[-2:]
        if sn == "01":
            a += l[i]
            ans_ += 10
        elif sn == "10":
            b += l[i]
            ans_ += 10
        elif sn == "11":
            c += l[i]
            ans_ += 10
    if a != 0 and b != 0 and c != 0:
        ans_ += abs(A - a) + abs(B - b) + abs(C - c) - 30
        if ans > ans_:
            ans = ans_
print(ans)

ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
N, A, B, C = rl()
l = [ri() for _ in range(N)]
ans = 10**18
import itertools

for seq in itertools.product(list(range(4)), repeat=N):
    a, b, c = 0, 0, 0
    rst = 0
    for i in range(N):
        if seq[i] == 1:
            a += l[i]
            rst += 10
        elif seq[i] == 2:
            b += l[i]
            rst += 10
        elif seq[i] == 3:
            c += l[i]
            rst += 10
    if a * b * c != 0:
        rst += abs(A - a) + abs(B - b) + abs(C - c) - 30
        if ans > rst:
            ans = rst
print(ans)

-l = [0] * N -for i in range(N): -    l[i] = ri() -ans = float("inf") -for n in range(4**N): +l = [ri() for _ in range(N)] +ans = 10**18 +import itertools + +for seq in itertools.product(list(range(4)), repeat=N): -    ans_ = 0 +    rst = 0 -        sn = format(n >> (2 * i), "0{}b".format(N))[-2:] -        if sn == "01": +        if seq[i] == 1: -            ans_ += 10 -        elif sn == "10": +            rst += 10 +        elif seq[i] == 2: -            ans_ += 10 -        elif sn == "11": +            rst += 10 +        elif seq[i] == 3: -            ans_ += 10 -    if a != 0 and b != 0 and c != 0: -        ans_ += abs(A - a) + abs(B - b) + abs(C - c) - 30 -        if ans > ans_: -            ans = ans_ +            rst += 10 +    if a * b * c != 0: +        rst += abs(A - a) + abs(B - b) + abs(C - c) - 30 +        if ans > rst: +            ans = rst