import os, sys, re, math

N,A,B,C = list(map(int,input().split(' ')))

bamboo = []
for i in range(N):
    bamboo.append(int(input()))
bamboo = sorted(bamboo)
memo = []

def doit2(targets):
    ret = 0
    c_bamboo = bamboo[:]
    for t in targets:
        tmp = doit(t, c_bamboo)
        ret += tmp
    return ret

def doit(target, bamboo):
    memo = [[[] for _ in range(1001)] for __ in range(N+1)]
    memo[0][0] = [0,[]]
    for i in range(len(bamboo)):
        b = bamboo[i]
        for j in range(1001):
            memo[i+1][j] = memo[i][j]
        for j in range(1001):
            if memo[i][j] and memo[i][j][0] >= 0 and b + j < 1001:
                if memo[i+1][b+j]:
                    if memo[i+1][b+j][0] > memo[i][j][0] + 1:
                        memo[i+1][b+j] = [memo[i][j][0]+1, memo[i][j][1] + [b]]
                else:
                    memo[i+1][b+j] = [memo[i][j][0]+1, memo[i][j][1] + [b]]

    ret = 1001
    remove_items = []
    for i in range(1,1001):
        if memo[len(bamboo)][i]:
            if ret > abs(target - i) + (memo[len(bamboo)][i][0] - 1) * 10:
                ret = abs(target - i) + (memo[len(bamboo)][i][0] - 1) * 10
                remove_items = memo[len(bamboo)][i][1]

    for r in remove_items:
        bamboo.remove(r)

    return ret

ret = 10000000000
for ts in [[A,B,C],[A,C,B],[B,A,C],[B,C,A],[C,A,B],[C,B,A]]:
    ret = min(ret,doit2(ts))

print(ret)
