n, a, b, c = [int(x) for x in input().split()]
l_list = [int(input()) for _ in range(n)]

s_list = [a, b, c]

ans = 10000
for i in range(4 ** n):
    mp = 0
    temp_l_list = [0, 0, 0]
    
    for j in range(n):
        temp = (i >> (2 * j)) & 3
        if temp == 3:
            continue

        if temp_l_list[temp] != 0:
            mp += 10
        temp_l_list[temp] += l_list[j]

    for s, temp_l in zip(s_list, temp_l_list):
        if temp_l == 0:
            break
        mp += abs(s - temp_l)
    else:
        if ans > mp:
            ans = mp
print(ans) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x n, a, b, c = [int(x) for x in input().split()] n [int(x) for x in input().split()] a b c int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input l_list = [int(input()) for _ in range(n)] l_list [int(input()) for _ in range(n)] s_list = [a, b, c] s_list [a, b, c] a b c ans = 10000 ans 10000 for i in range(4 ** n):
    mp = 0
    temp_l_list = [0, 0, 0]
    
    for j in range(n):
        temp = (i >> (2 * j)) & 3
        if temp == 3:
            continue

        if temp_l_list[temp] != 0:
            mp += 10
        temp_l_list[temp] += l_list[j]

    for s, temp_l in zip(s_list, temp_l_list):
        if temp_l == 0:
            break
        mp += abs(s - temp_l)
    else:
        if ans > mp:
            ans = mp i range(4 ** n) range 4 ** n 4 n mp = 0 mp 0 temp_l_list = [0, 0, 0] temp_l_list [0, 0, 0] 0 0 0 for j in range(n):
        temp = (i >> (2 * j)) & 3
        if temp == 3:
            continue

        if temp_l_list[temp] != 0:
            mp += 10
        temp_l_list[temp] += l_list[j]

     j range(n) range n temp = (i >> (2 * j)) & 3 temp (i >> (2 * j)) & 3 i >> (2 * j) i 2 * j 2 j 3 if temp == 3:
            continue

         temp == 3 temp 3 continue if temp_l_list[temp] != 0:
            mp += 10
         temp_l_list[temp] != 0 temp_l_list[temp] temp_l_list temp 0 mp += 10 mp 10 temp_l_list[temp] += l_list[j] temp_l_list[temp] temp_l_list temp l_list[j] l_list j for s, temp_l in zip(s_list, temp_l_list):
        if temp_l == 0:
            break
        mp += abs(s - temp_l)
    else:
        if ans > mp:
            ans = mp s temp_l zip(s_list, temp_l_list) zip s_list temp_l_list if temp_l == 0:
            break
         temp_l == 0 temp_l 0 break mp += abs(s - temp_l) mp abs(s - temp_l) abs s - temp_l s temp_l if ans > mp:
            ans = mp ans > mp ans mp ans = mp ans mp print(ans) print ans temp = (i >> (2 * j)) & 3 (i >> (2 * j)) & 3 temp l_list = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] l_list temp_l_list = [0, 0, 0] [0, 0, 0] temp_l_list mp += abs(s - temp_l) abs(s - temp_l) mp s_list = [a, b, c] [a, b, c] s_list ans = 10000 10000 ans mp = 0 0 mp a, b, c = [int(x) for x in input().split()] [int(x) for x in input().split()] a mp += 10 10 mp b, c = [int(x) for x in input().split()] [int(x) for x in input().split()] b n, a, b, c = [int(x) for x in input().split()] [int(x) for x in input().split()] n c = [int(x) for x in input().split()] [int(x) for x in input().split()] c ans = mp mp ans
n, a, b, c = [int(x) for x in input().split()]
l_list = [int(input()) for _ in range(n)]

s_list = [a, b, c]

ans = 10000
for i in range(4 ** n):
    mp = 0
    temp_l_list = [0, 0, 0]
    
    for j in range(n):
        temp = (i >> (2 * j)) & 3
        if temp == 3:
            continue

        if temp_l_list[temp] != 0:
            mp += 10
        temp_l_list[temp] += l_list[j]

    for s, temp_l in zip(s_list, temp_l_list):
        if temp_l == 0:
            break
        mp += abs(s - temp_l)
    else:
        if ans > mp:
            ans = mp
print(ans)