import sys,math,collections,itertools
input = sys.stdin.readline

N,A,B,C=list(map(int,input().split()))
l = [ int(input()) for _ in range(N)]

use_list = list(itertools.product(range(4),repeat = N))
point = float('inf')

for i in range(len(use_list)):
    ABC = [0]*3
    count = [0]*3
    if (0 not in use_list[i]) or(1 not in use_list[i]) or (2 not in use_list[i]):
        continue
    for j in range(len(use_list[i])):
        if use_list[i][j] != 3:
            ABC[use_list[i][j]] += l[j]
            count[use_list[i][j]] += 1
    p = (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B)+abs(ABC[2]-C)
    point = min(point,p)   
print(point) import sys,math,collections,itertools sys math collections itertools input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N,A,B,C=list(map(int,input().split())) N list(map(int,input().split())) list 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)] use_list = list(itertools.product(range(4),repeat = N)) use_list list(itertools.product(range(4),repeat = N)) list itertools.product(range(4),repeat = N) itertools.product itertools product range(4) range 4 repeat = N repeat N point = float('inf') point float('inf') float 'inf' for i in range(len(use_list)):
    ABC = [0]*3
    count = [0]*3
    if (0 not in use_list[i]) or(1 not in use_list[i]) or (2 not in use_list[i]):
        continue
    for j in range(len(use_list[i])):
        if use_list[i][j] != 3:
            ABC[use_list[i][j]] += l[j]
            count[use_list[i][j]] += 1
    p = (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B)+abs(ABC[2]-C)
    point = min(point,p)    i range(len(use_list)) range len(use_list) len use_list ABC = [0]*3 ABC [0]*3 [0] 0 3 count = [0]*3 count [0]*3 [0] 0 3 if (0 not in use_list[i]) or(1 not in use_list[i]) or (2 not in use_list[i]):
        continue
     (0 not in use_list[i]) or(1 not in use_list[i]) or (2 not in use_list[i]) (0 not in use_list[i]) or(1 not in use_list[i]) 0 not in use_list[i] 0 use_list[i] use_list i 1 not in use_list[i] 1 use_list[i] use_list i 2 not in use_list[i] 2 use_list[i] use_list i continue for j in range(len(use_list[i])):
        if use_list[i][j] != 3:
            ABC[use_list[i][j]] += l[j]
            count[use_list[i][j]] += 1
     j range(len(use_list[i])) range len(use_list[i]) len use_list[i] use_list i if use_list[i][j] != 3:
            ABC[use_list[i][j]] += l[j]
            count[use_list[i][j]] += 1
     use_list[i][j] != 3 use_list[i][j] [i] use_list i j 3 ABC[use_list[i][j]] += l[j] ABC[use_list[i][j]] ABC use_list[i][j] [i] use_list i j l[j] l j count[use_list[i][j]] += 1 count[use_list[i][j]] count use_list[i][j] [i] use_list i j 1 p = (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B)+abs(ABC[2]-C) p (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B)+abs(ABC[2]-C) (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B) (sum(count)-len(count))*10+abs(ABC[0]-A) (sum(count)-len(count))*10 sum(count)-len(count) sum(count) sum count len(count) len count 10 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 point = min(point,p) point min(point,p) min point p print(point) print point A,B,C=list(map(int,input().split())) list(map(int,input().split())) A point = float('inf') float('inf') point use_list = list(itertools.product(range(4),repeat = N)) list(itertools.product(range(4),repeat = N)) use_list N,A,B,C=list(map(int,input().split())) list(map(int,input().split())) N C=list(map(int,input().split())) list(map(int,input().split())) C l = [ int(input()) for _ in range(N)] [ int(input()) for _ in range(N)] l B,C=list(map(int,input().split())) list(map(int,input().split())) B ABC = [0]*3 [0]*3 ABC point = min(point,p) min(point,p) point count = [0]*3 [0]*3 count input = sys.stdin.readline sys.stdin.readline input p = (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B)+abs(ABC[2]-C) (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B)+abs(ABC[2]-C) p
import sys,math,collections,itertools
input = sys.stdin.readline

N,A,B,C=list(map(int,input().split()))
l = [ int(input()) for _ in range(N)]

use_list = list(itertools.product(range(4),repeat = N))
point = float('inf')

for i in range(len(use_list)):
    ABC = [0]*3
    count = [0]*3
    if (0 not in use_list[i]) or(1 not in use_list[i]) or (2 not in use_list[i]):
        continue
    for j in range(len(use_list[i])):
        if use_list[i][j] != 3:
            ABC[use_list[i][j]] += l[j]
            count[use_list[i][j]] += 1
    p = (sum(count)-len(count))*10+abs(ABC[0]-A)+abs(ABC[1]-B)+abs(ABC[2]-C)
    point = min(point,p)   
print(point)
