n,a,b,c = map(int,input().split())
m = [a,b,c]
l = sorted([int(input()) for i in range(n)])

import itertools 
data = list(itertools.product(range(4), repeat = n))

ans = float('inf')
for d in data:
    x = [[] for i in range(4)]
    for i in range(n):
        x[d[i]].append(l[i])
    if len(x[0])<1 or len(x[1])<1 or len(x[2])<1:
        continue
    buf = 0
    for i in range(3):
        buf += 10*(len(x[i])-1)
        buf += abs(sum(x[i])-m[i])

    ans = min(ans,buf)
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 m = [a,b,c] m [a,b,c] a b c int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input l = sorted([int(input()) for i in range(n)]) l sorted([int(input()) for i in range(n)]) sorted [int(input()) for i in range(n)] import itertools itertools data = list(itertools.product(range(4), repeat = n)) data 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 ans = float('inf') ans float('inf') float 'inf' for d in data:
    x = [[] for i in range(4)]
    for i in range(n):
        x[d[i]].append(l[i])
    if len(x[0])<1 or len(x[1])<1 or len(x[2])<1:
        continue
    buf = 0
    for i in range(3):
        buf += 10*(len(x[i])-1)
        buf += abs(sum(x[i])-m[i])

    ans = min(ans,buf) d data [] for i in range(4) for i in range(4) i range(4) range 4 for i in range(4) [] x = [[] for i in range(4)] x [[] for i in range(4)] for i in range(n):
        x[d[i]].append(l[i])
     i range(n) range n x[d[i]].append(l[i]) [d[i]].append [d[i]] x d[i] d i append l[i] l i if len(x[0])<1 or len(x[1])<1 or len(x[2])<1:
        continue
     len(x[0])<1 or len(x[1])<1 or len(x[2])<1 len(x[0])<1 or len(x[1])<1 len(x[0])<1 len(x[0]) len x[0] x 0 1 len(x[1])<1 len(x[1]) len x[1] x 1 1 len(x[2])<1 len(x[2]) len x[2] x 2 1 continue buf = 0 buf 0 for i in range(3):
        buf += 10*(len(x[i])-1)
        buf += abs(sum(x[i])-m[i])

     i range(3) range 3 buf += 10*(len(x[i])-1) buf 10*(len(x[i])-1) 10 len(x[i])-1 len(x[i]) len x[i] x i 1 buf += abs(sum(x[i])-m[i]) buf abs(sum(x[i])-m[i]) abs sum(x[i])-m[i] sum(x[i]) sum x[i] x i m[i] m i ans = min(ans,buf) ans min(ans,buf) min ans buf print(ans) print ans ans = float('inf') float('inf') ans m = [a,b,c] [a,b,c] m n,a,b,c = map(int,input().split()) map(int,input().split()) n c = map(int,input().split()) map(int,input().split()) c l = sorted([int(input()) for i in range(n)]) sorted([int(input()) for i in range(n)]) l b,c = map(int,input().split()) map(int,input().split()) b buf += 10*(len(x[i])-1) 10*(len(x[i])-1) buf a,b,c = map(int,input().split()) map(int,input().split()) a ans = min(ans,buf) min(ans,buf) ans buf += abs(sum(x[i])-m[i]) abs(sum(x[i])-m[i]) buf data = list(itertools.product(range(4), repeat = n)) list(itertools.product(range(4), repeat = n)) data x = [[] for i in range(4)] [[] for i in range(4)] x buf = 0 0 buf
n,a,b,c = map(int,input().split())
m = [a,b,c]
l = sorted([int(input()) for i in range(n)])

import itertools 
data = list(itertools.product(range(4), repeat = n))

ans = float('inf')
for d in data:
    x = [[] for i in range(4)]
    for i in range(n):
        x[d[i]].append(l[i])
    if len(x[0])<1 or len(x[1])<1 or len(x[2])<1:
        continue
    buf = 0
    for i in range(3):
        buf += 10*(len(x[i])-1)
        buf += abs(sum(x[i])-m[i])

    ans = min(ans,buf)
print(ans)

