n,A,B,C = map(int,input().split())
L = [int(input()) for _ in range(n)]

ans = float('inf')
for i in range(2**n):
    for j in range(2**n):
        where = [0]*n
        x,y = i,j
        b = 0
        while x > 0 or y > 0:
            where[b] += (x&1) + 2*(y&1)
            b += 1
            x,y = x >> 1 , y >> 1
        cnt = -30
        ABC = [0,0,0]
        for x,w in enumerate(where):
            if w == 0:continue
            ABC[w-1] += L[x]
            cnt += 10
        if 0 in ABC:continue
        ans = min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C))
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 int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input L = [int(input()) for _ in range(n)] L [int(input()) for _ in range(n)] ans = float('inf') ans float('inf') float 'inf' for i in range(2**n):
    for j in range(2**n):
        where = [0]*n
        x,y = i,j
        b = 0
        while x > 0 or y > 0:
            where[b] += (x&1) + 2*(y&1)
            b += 1
            x,y = x >> 1 , y >> 1
        cnt = -30
        ABC = [0,0,0]
        for x,w in enumerate(where):
            if w == 0:continue
            ABC[w-1] += L[x]
            cnt += 10
        if 0 in ABC:continue
        ans = min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C)) i range(2**n) range 2**n 2 n for j in range(2**n):
        where = [0]*n
        x,y = i,j
        b = 0
        while x > 0 or y > 0:
            where[b] += (x&1) + 2*(y&1)
            b += 1
            x,y = x >> 1 , y >> 1
        cnt = -30
        ABC = [0,0,0]
        for x,w in enumerate(where):
            if w == 0:continue
            ABC[w-1] += L[x]
            cnt += 10
        if 0 in ABC:continue
        ans = min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C)) j range(2**n) range 2**n 2 n where = [0]*n where [0]*n [0] 0 n x,y = i,j x i y j b = 0 b 0 while x > 0 or y > 0:
            where[b] += (x&1) + 2*(y&1)
            b += 1
            x,y = x >> 1 , y >> 1
         x > 0 or y > 0 x > 0 x 0 y > 0 y 0 where[b] += (x&1) + 2*(y&1) where[b] where b (x&1) + 2*(y&1) x&1 x 1 2*(y&1) 2 y&1 y 1 b += 1 b 1 x,y = x >> 1 , y >> 1 x x >> 1 x 1 y y >> 1 y 1 cnt = -30 cnt -30 ABC = [0,0,0] ABC [0,0,0] 0 0 0 for x,w in enumerate(where):
            if w == 0:continue
            ABC[w-1] += L[x]
            cnt += 10
         x w enumerate(where) enumerate where if w == 0:continue
             w == 0 w 0 ABC[w-1] += L[x] ABC[w-1] ABC w-1 w 1 L[x] L x cnt += 10 cnt 10 if 0 in ABC:continue
         0 in ABC 0 ABC ans = min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C)) ans min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C)) min ans cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C) cnt + abs(ABC[0] - A) + abs(ABC[1] - B) cnt + abs(ABC[0] - A) cnt abs(ABC[0] - A) abs ABC[0] - A ABC[0] ABC 0 A abs(ABC[1] - B) abs ABC[1] - B ABC[1] ABC 1 B abs(ABC[2] - C) abs ABC[2] - C ABC[2] ABC 2 C print(ans) print ans x,y = x >> 1 , y >> 1 x >> 1 x n,A,B,C = map(int,input().split()) map(int,input().split()) n B,C = map(int,input().split()) map(int,input().split()) B ans = min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C)) min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C)) ans C = map(int,input().split()) map(int,input().split()) C x,y = i,j i x ABC = [0,0,0] [0,0,0] ABC L = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] L where = [0]*n [0]*n where A,B,C = map(int,input().split()) map(int,input().split()) A b += 1 1 b cnt = -30 -30 cnt y = i,j j y ans = float('inf') float('inf') ans cnt += 10 10 cnt b = 0 0 b y = x >> 1 , y >> 1 y >> 1 y
n,A,B,C = map(int,input().split())
L = [int(input()) for _ in range(n)]

ans = float('inf')
for i in range(2**n):
    for j in range(2**n):
        where = [0]*n
        x,y = i,j
        b = 0
        while x > 0 or y > 0:
            where[b] += (x&1) + 2*(y&1)
            b += 1
            x,y = x >> 1 , y >> 1
        cnt = -30
        ABC = [0,0,0]
        for x,w in enumerate(where):
            if w == 0:continue
            ABC[w-1] += L[x]
            cnt += 10
        if 0 in ABC:continue
        ans = min(ans, cnt + abs(ABC[0] - A) + abs(ABC[1] - B) + abs(ABC[2] - C))
print(ans)
