n,a,b,c = map(int,input().split())
L = []
for i in range(n):
    L.append(int(input()))
import itertools
ans = 10**9
tmp = 0
for use in itertools.product([0,1,2,-1] ,repeat=n):
    tmp = 0
    ls = [0,0,0]
    for idx,u in enumerate(use):
        if u>-1:
            if ls[u] >0:
                tmp+=10
            ls[u]+=L[idx]

    if ls[0] ==0 or ls[1] ==0 or ls[2] ==0:continue
    tmp = tmp + abs(ls[0] -a) +abs(ls[1] -b)+abs(ls[2] -c)
    ans = min(tmp,ans)
print(ans) n,a,b,c = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split a b c L = [] L [] for i in range(n):
    L.append(int(input())) i range(n) range n L.append(int(input())) L.append L append int(input()) int input() input import itertools itertools ans = 10**9 ans 10**9 10 9 tmp = 0 tmp 0 for use in itertools.product([0,1,2,-1] ,repeat=n):
    tmp = 0
    ls = [0,0,0]
    for idx,u in enumerate(use):
        if u>-1:
            if ls[u] >0:
                tmp+=10
            ls[u]+=L[idx]

    if ls[0] ==0 or ls[1] ==0 or ls[2] ==0:continue
    tmp = tmp + abs(ls[0] -a) +abs(ls[1] -b)+abs(ls[2] -c)
    ans = min(tmp,ans) use itertools.product([0,1,2,-1] ,repeat=n) itertools.product itertools product [0,1,2,-1] 0 1 2 -1 repeat=n repeat n tmp = 0 tmp 0 ls = [0,0,0] ls [0,0,0] 0 0 0 for idx,u in enumerate(use):
        if u>-1:
            if ls[u] >0:
                tmp+=10
            ls[u]+=L[idx]

     idx u enumerate(use) enumerate use if u>-1:
            if ls[u] >0:
                tmp+=10
            ls[u]+=L[idx]

     u>-1 u -1 if ls[u] >0:
                tmp+=10
             ls[u] >0 ls[u] ls u 0 tmp+=10 tmp 10 ls[u]+=L[idx] ls[u] ls u L[idx] L idx if ls[0] ==0 or ls[1] ==0 or ls[2] ==0:continue
     ls[0] ==0 or ls[1] ==0 or ls[2] ==0 ls[0] ==0 or ls[1] ==0 ls[0] ==0 ls[0] ls 0 0 ls[1] ==0 ls[1] ls 1 0 ls[2] ==0 ls[2] ls 2 0 tmp = tmp + abs(ls[0] -a) +abs(ls[1] -b)+abs(ls[2] -c) tmp tmp + abs(ls[0] -a) +abs(ls[1] -b)+abs(ls[2] -c) tmp + abs(ls[0] -a) +abs(ls[1] -b) tmp + abs(ls[0] -a) tmp abs(ls[0] -a) abs ls[0] -a ls[0] ls 0 a abs(ls[1] -b) abs ls[1] -b ls[1] ls 1 b abs(ls[2] -c) abs ls[2] -c ls[2] ls 2 c ans = min(tmp,ans) ans min(tmp,ans) min tmp ans print(ans) print ans a,b,c = map(int,input().split()) map(int,input().split()) a tmp = tmp + abs(ls[0] -a) +abs(ls[1] -b)+abs(ls[2] -c) tmp + abs(ls[0] -a) +abs(ls[1] -b)+abs(ls[2] -c) tmp tmp+=10 10 tmp b,c = map(int,input().split()) map(int,input().split()) b L = [] [] L ans = 10**9 10**9 ans ans = min(tmp,ans) min(tmp,ans) ans ls = [0,0,0] [0,0,0] ls n,a,b,c = map(int,input().split()) map(int,input().split()) n c = map(int,input().split()) map(int,input().split()) c tmp = 0 0 tmp tmp = 0 0 tmp
n,a,b,c = map(int,input().split())
L = []
for i in range(n):
    L.append(int(input()))
import itertools
ans = 10**9
tmp = 0
for use in itertools.product([0,1,2,-1] ,repeat=n):
    tmp = 0
    ls = [0,0,0]
    for idx,u in enumerate(use):
        if u>-1:
            if ls[u] >0:
                tmp+=10
            ls[u]+=L[idx]

    if ls[0] ==0 or ls[1] ==0 or ls[2] ==0:continue
    tmp = tmp + abs(ls[0] -a) +abs(ls[1] -b)+abs(ls[2] -c)
    ans = min(tmp,ans)
print(ans)
