n, a, b, c = map(int, input().split())
T = [a, b, c]
L = [int(input()) for _ in range(n)]

import itertools
ans = 10**18
for p in itertools.product(range(4), repeat=n):
    C = [0]*3
    temp = [0]*3
    for i in range(n):
        if p[i] == 3:
            continue
        C[p[i]] += 1
        temp[p[i]] += L[i]
    flag = True
    for i in range(3):
        if C[i] == 0:
            flag = False
            break
    if not flag:
        continue
    mp = 0
    for i in range(3):
        mp += 10*(C[i]-1)
        mp += abs(temp[i]-T[i])
    ans = min(ans, mp)
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 T = [a, b, c] T [a, b, c] 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)] import itertools itertools ans = 10**18 ans 10**18 10 18 for p in itertools.product(range(4), repeat=n):
    C = [0]*3
    temp = [0]*3
    for i in range(n):
        if p[i] == 3:
            continue
        C[p[i]] += 1
        temp[p[i]] += L[i]
    flag = True
    for i in range(3):
        if C[i] == 0:
            flag = False
            break
    if not flag:
        continue
    mp = 0
    for i in range(3):
        mp += 10*(C[i]-1)
        mp += abs(temp[i]-T[i])
    ans = min(ans, mp) p itertools.product(range(4), repeat=n) itertools.product itertools product range(4) range 4 repeat=n repeat n C = [0]*3 C [0]*3 [0] 0 3 temp = [0]*3 temp [0]*3 [0] 0 3 for i in range(n):
        if p[i] == 3:
            continue
        C[p[i]] += 1
        temp[p[i]] += L[i]
     i range(n) range n if p[i] == 3:
            continue
         p[i] == 3 p[i] p i 3 continue C[p[i]] += 1 C[p[i]] C p[i] p i 1 temp[p[i]] += L[i] temp[p[i]] temp p[i] p i L[i] L i flag = True flag True for i in range(3):
        if C[i] == 0:
            flag = False
            break
     i range(3) range 3 if C[i] == 0:
            flag = False
            break
     C[i] == 0 C[i] C i 0 flag = False flag False break if not flag:
        continue
     not flag flag continue mp = 0 mp 0 for i in range(3):
        mp += 10*(C[i]-1)
        mp += abs(temp[i]-T[i])
     i range(3) range 3 mp += 10*(C[i]-1) mp 10*(C[i]-1) 10 C[i]-1 C[i] C i 1 mp += abs(temp[i]-T[i]) mp abs(temp[i]-T[i]) abs temp[i]-T[i] temp[i] temp i T[i] T i ans = min(ans, mp) ans min(ans, mp) min ans mp print(ans) print ans c = map(int, input().split()) map(int, input().split()) c flag = False False flag temp = [0]*3 [0]*3 temp C = [0]*3 [0]*3 C ans = min(ans, mp) min(ans, mp) ans n, a, b, c = map(int, input().split()) map(int, input().split()) n mp += abs(temp[i]-T[i]) abs(temp[i]-T[i]) mp mp += 10*(C[i]-1) 10*(C[i]-1) mp ans = 10**18 10**18 ans T = [a, b, c] [a, b, c] T a, b, c = map(int, input().split()) map(int, input().split()) a L = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] L mp = 0 0 mp flag = True True flag b, c = map(int, input().split()) map(int, input().split()) b
n, a, b, c = map(int, input().split())
T = [a, b, c]
L = [int(input()) for _ in range(n)]

import itertools
ans = 10**18
for p in itertools.product(range(4), repeat=n):
    C = [0]*3
    temp = [0]*3
    for i in range(n):
        if p[i] == 3:
            continue
        C[p[i]] += 1
        temp[p[i]] += L[i]
    flag = True
    for i in range(3):
        if C[i] == 0:
            flag = False
            break
    if not flag:
        continue
    mp = 0
    for i in range(3):
        mp += 10*(C[i]-1)
        mp += abs(temp[i]-T[i])
    ans = min(ans, mp)
print(ans)
